hoangkha1810 commited on
Commit
23a42f6
·
verified ·
1 Parent(s): 095a8d4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -1
main.py CHANGED
@@ -11,6 +11,8 @@ from huggingface_hub import hf_hub_download
11
  from safetensors.torch import load_file
12
  from fastapi.responses import FileResponse
13
 
 
 
14
  # Thiết lập logging
15
  logging.basicConfig(level=logging.INFO)
16
  logger = logging.getLogger(__name__)
@@ -139,4 +141,8 @@ async def generate_video(request: VideoRequest):
139
  # Endpoint kiểm tra trạng thái
140
  @app.get("/")
141
  async def root():
142
- return {"message": "FastAPI AnimateDiff-Lightning API on Hugging Face Spaces"}
 
 
 
 
 
11
  from safetensors.torch import load_file
12
  from fastapi.responses import FileResponse
13
 
14
+ app = FastAPI()
15
+
16
  # Thiết lập logging
17
  logging.basicConfig(level=logging.INFO)
18
  logger = logging.getLogger(__name__)
 
141
  # Endpoint kiểm tra trạng thái
142
  @app.get("/")
143
  async def root():
144
+ return {"message": "FastAPI AnimateDiff-Lightning API on Hugging Face Spaces"}
145
+
146
+ if __name__ == "__main__":
147
+ port = int(os.environ.get("PORT", 7860)) # Nếu PORT không có thì mặc định 7860
148
+ uvicorn.run("main:app", host="0.0.0.0", port=port, reload=False)