Spaces:
Running
Running
File size: 2,226 Bytes
0ad7e2a 91fb4ef 0ad7e2a 91fb4ef 0ad7e2a 82a6631 0ad7e2a 956cf49 91fb4ef b613c3c 89bbef2 91fb4ef 0ad7e2a 91fb4ef 0ad7e2a 91fb4ef 0ad7e2a 89bbef2 b613c3c 91fb4ef 0ad7e2a 91fb4ef 0ad7e2a 91fb4ef 0ad7e2a aa1e877 91fb4ef 956cf49 68006fa 0ad7e2a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
"""
Main application entry point for Video Model Studio
"""
import gradio as gr
import platform
import subprocess
import logging
from pathlib import Path
from vms.config import (
STORAGE_PATH, VIDEOS_TO_SPLIT_PATH, STAGING_PATH,
TRAINING_PATH, TRAINING_VIDEOS_PATH, MODEL_PATH,
OUTPUT_PATH, ASK_USER_TO_DUPLICATE_SPACE,
HF_API_TOKEN, VMS_ADMIN_PASSWORD
)
from vms.ui.app_ui import AppUI
# Configure logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def create_app():
"""Create the main Gradio application"""
# If space needs to be duplicated
if ASK_USER_TO_DUPLICATE_SPACE:
with gr.Blocks() as app:
gr.Markdown("""# Finetrainers UI
This Hugging Face space needs to be duplicated to your own billing account to work.
Click the 'Duplicate Space' button at the top of the page to create your own copy.
It is recommended to use a Nvidia L40S and a persistent storage space.
To avoid overpaying for your space, you can configure the auto-sleep settings to fit your personal budget.""")
return app
# Create the main application UI
ui = AppUI()
app = ui.create_ui()
return app
def main():
"""Main entry point for the application"""
# Handle Linux-specific setup if needed
if platform.system() == "Linux":
# Placeholder for any Linux-specific initialization
# For example, pip installations or environment setup
pass
# Create the Gradio app
app = create_app()
# Define allowed paths for file access
allowed_paths = [
str(STORAGE_PATH), # Base storage
str(VIDEOS_TO_SPLIT_PATH),
str(STAGING_PATH),
str(TRAINING_PATH),
str(TRAINING_VIDEOS_PATH),
str(MODEL_PATH),
str(OUTPUT_PATH)
]
# Launch the Gradio app
app.queue(default_concurrency_limit=2).launch(
server_name="0.0.0.0",
allowed_paths=allowed_paths,
# for some reason this crashes Gradio
# I was expecting to see a login modal or something
# but instead this creates an infinite loop
#auth=("admin", VMS_ADMIN_PASSWORD) if VMS_ADMIN_PASSWORD else None
)
if __name__ == "__main__":
main() |