Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,17 +46,27 @@ def call_framepack_api(
|
|
| 46 |
if lora_file:
|
| 47 |
files["lora_file"] = (lora_file.name, lora_file, "application/octet-stream")
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
try:
|
| 50 |
response = requests.post(API_URL, data=data, files=files)
|
|
|
|
| 51 |
if response.status_code == 200:
|
| 52 |
result = response.json()
|
| 53 |
video_url = result.get("video_url")
|
| 54 |
preview_url = result.get("preview_image_url")
|
| 55 |
-
|
|
|
|
| 56 |
else:
|
| 57 |
-
|
|
|
|
| 58 |
except Exception as e:
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
|
| 61 |
with gr.Blocks() as demo:
|
| 62 |
gr.Markdown("# FramePack API Client with Full Options")
|
|
|
|
| 46 |
if lora_file:
|
| 47 |
files["lora_file"] = (lora_file.name, lora_file, "application/octet-stream")
|
| 48 |
|
| 49 |
+
# Prepare log string for display
|
| 50 |
+
log_str = f"Calling API at: {API_URL}\n"
|
| 51 |
+
log_str += f"Payload data:\n{data}\n"
|
| 52 |
+
log_str += f"Files sent: {list(files.keys())}\n"
|
| 53 |
+
|
| 54 |
try:
|
| 55 |
response = requests.post(API_URL, data=data, files=files)
|
| 56 |
+
log_str += f"Response status: {response.status_code}\n"
|
| 57 |
if response.status_code == 200:
|
| 58 |
result = response.json()
|
| 59 |
video_url = result.get("video_url")
|
| 60 |
preview_url = result.get("preview_image_url")
|
| 61 |
+
log_str += f"Response JSON:\n{result}\n"
|
| 62 |
+
return video_url, preview_url, log_str
|
| 63 |
else:
|
| 64 |
+
log_str += f"API Error: {response.status_code} - {response.text}\n"
|
| 65 |
+
return None, None, log_str
|
| 66 |
except Exception as e:
|
| 67 |
+
log_str += f"Exception: {str(e)}\n"
|
| 68 |
+
return None, None, log_str
|
| 69 |
+
|
| 70 |
|
| 71 |
with gr.Blocks() as demo:
|
| 72 |
gr.Markdown("# FramePack API Client with Full Options")
|