Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,26 @@ from rife_model import load_rife_model, rife_inference_with_latents
|
|
36 |
from huggingface_hub import hf_hub_download, snapshot_download
|
37 |
import gc
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
40 |
|
41 |
hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
|
@@ -486,6 +506,12 @@ with gr.Blocks() as demo:
|
|
486 |
enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
|
487 |
video_input.upload(resize_if_unfit, inputs=[video_input], outputs=[video_input])
|
488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
if __name__ == "__main__":
|
490 |
demo.queue(max_size=15)
|
491 |
demo.launch()
|
|
|
36 |
from huggingface_hub import hf_hub_download, snapshot_download
|
37 |
import gc
|
38 |
|
39 |
+
from fastapi import FastAPI, HTTPException
|
40 |
+
from fastapi.middleware.cors import CORSMiddleware
|
41 |
+
from fastapi.responses import FileResponse
|
42 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
43 |
+
|
44 |
+
from data_class.GenerateResponse import GenerateResponse
|
45 |
+
from data_class.GenerateRequest import GenerateRequest
|
46 |
+
|
47 |
+
app = FastAPI()
|
48 |
+
|
49 |
+
# CORS Configuration
|
50 |
+
app.add_middleware(
|
51 |
+
CORSMiddleware,
|
52 |
+
allow_origins=["*"],
|
53 |
+
allow_credentials=True,
|
54 |
+
allow_methods=["*"],
|
55 |
+
allow_headers=["*"],
|
56 |
+
)
|
57 |
+
|
58 |
+
|
59 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
60 |
|
61 |
hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
|
|
|
506 |
enhance_button.click(enhance_prompt_func, inputs=[prompt], outputs=[prompt])
|
507 |
video_input.upload(resize_if_unfit, inputs=[video_input], outputs=[video_input])
|
508 |
|
509 |
+
@app.get("/health")
|
510 |
+
def health_check():
|
511 |
+
"""Simple health check endpoint"""
|
512 |
+
return {"status": "OK"}
|
513 |
+
|
514 |
+
|
515 |
if __name__ == "__main__":
|
516 |
demo.queue(max_size=15)
|
517 |
demo.launch()
|