|
""" |
|
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, MODELS_PATH, |
|
ASK_USER_TO_DUPLICATE_SPACE, |
|
HF_API_TOKEN, VMS_ADMIN_PASSWORD |
|
) |
|
|
|
from vms.ui.app_ui import AppUI |
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
logger.setLevel(logging.INFO) |
|
|
|
def create_app(): |
|
"""Create the main Gradio application""" |
|
|
|
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 |
|
|
|
|
|
ui = AppUI() |
|
app = ui.create_ui() |
|
|
|
return app |
|
|
|
def main(): |
|
"""Main entry point for the application""" |
|
|
|
if platform.system() == "Linux": |
|
|
|
|
|
pass |
|
|
|
|
|
app = create_app() |
|
|
|
|
|
allowed_paths = [ |
|
str(STORAGE_PATH), |
|
str(VIDEOS_TO_SPLIT_PATH), |
|
str(STAGING_PATH), |
|
str(MODELS_PATH), |
|
] |
|
|
|
|
|
app.queue(default_concurrency_limit=10).launch( |
|
server_name="0.0.0.0", |
|
allowed_paths=allowed_paths, |
|
|
|
max_threads=60, |
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
|
if __name__ == "__main__": |
|
main() |