Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,18 @@ import requests
|
|
| 3 |
|
| 4 |
API_URL = "https://rahul7star-FramePack-F1-DiffusionForce.hf.space/api/generate/"
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def call_framepack_api(
|
| 7 |
input_image,
|
| 8 |
prompt,
|
|
@@ -92,6 +104,10 @@ with gr.Blocks() as demo:
|
|
| 92 |
fp8_optimization = gr.Checkbox(label="FP8 Optimization", value=False)
|
| 93 |
|
| 94 |
generate_btn = gr.Button("Generate")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
with gr.Column():
|
| 97 |
video_output = gr.Video(label="Generated Video", autoplay=True)
|
|
|
|
| 3 |
|
| 4 |
API_URL = "https://rahul7star-FramePack-F1-DiffusionForce.hf.space/api/generate/"
|
| 5 |
|
| 6 |
+
HEALTH_API_URL = "https://rahul7star-FramePack-F1-DiffusionForce.hf.space/api/healthcheck"
|
| 7 |
+
|
| 8 |
+
def check_health():
|
| 9 |
+
try:
|
| 10 |
+
response = requests.get(HEALTH_API_URL)
|
| 11 |
+
if response.status_code == 200:
|
| 12 |
+
return f"✅ API is healthy: {response.json()}"
|
| 13 |
+
else:
|
| 14 |
+
return f"❌ API Error: {response.status_code} - {response.text}"
|
| 15 |
+
except Exception as e:
|
| 16 |
+
return f"❌ Exception occurred: {str(e)}"
|
| 17 |
+
|
| 18 |
def call_framepack_api(
|
| 19 |
input_image,
|
| 20 |
prompt,
|
|
|
|
| 104 |
fp8_optimization = gr.Checkbox(label="FP8 Optimization", value=False)
|
| 105 |
|
| 106 |
generate_btn = gr.Button("Generate")
|
| 107 |
+
health_btn = gr.Button("Check API Health")
|
| 108 |
+
health_output = gr.Textbox(label="Health Check Result")
|
| 109 |
+
|
| 110 |
+
health_btn.click(fn=check_health, inputs=[], outputs=[health_output])
|
| 111 |
|
| 112 |
with gr.Column():
|
| 113 |
video_output = gr.Video(label="Generated Video", autoplay=True)
|