Spaces:
Sleeping
Sleeping
File size: 1,233 Bytes
627d3d7 d2b7e94 627d3d7 bed01bd 627d3d7 bed01bd 627d3d7 d2b7e94 bed01bd 627d3d7 |
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 |
import argparse
import logging
import os
import dotenv
from fastapi import FastAPI
from launch import setup_uvicon_args
from modules.ffmpeg_env import setup_ffmpeg_path
from modules.models_setup import process_model_args, setup_model_args
setup_ffmpeg_path()
logging.basicConfig(
level=os.getenv("LOG_LEVEL", "INFO"),
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
from modules import config
from modules.api.api_setup import process_api_args, setup_api_args
from modules.api.app_config import app_description, app_title, app_version
from modules.utils.torch_opt import configure_torch_optimizations
dotenv.load_dotenv(
dotenv_path=os.getenv("ENV_FILE", ".env.api"),
)
parser = argparse.ArgumentParser(
description="Start the FastAPI server with command line arguments"
)
setup_api_args(parser)
setup_model_args(parser)
setup_uvicon_args(parser)
args = parser.parse_args()
app = FastAPI(
title=app_title,
description=app_description,
version=app_version,
redoc_url=None if config.runtime_env_vars.no_docs else "/redoc",
docs_url=None if config.runtime_env_vars.no_docs else "/docs",
)
process_model_args(args)
process_api_args(args, app)
configure_torch_optimizations()
|