Spaces:
Sleeping
Sleeping
bulletproof telegraph mate, gemini levels
Browse filesasked dumbmini if its generated code was "bulletproof" 3 times and it said no and gave new "bulletproof" code each times, apparently Telegra.ph won't work either so now we're on FreeImage.host with a permanent, public developer key.
app.py
CHANGED
|
@@ -59,18 +59,31 @@ def generate_frames(sketch_1, sketch_2, image_prompt, ctrl_scale, consistency):
|
|
| 59 |
# PHASE 2: CPU ORCHESTRATION (API & UI)
|
| 60 |
# ==========================================
|
| 61 |
def upload_to_web(image):
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
response = requests.post(
|
| 65 |
-
"https://catbox.moe/user/api.php",
|
| 66 |
-
data={"reqtype": "fileupload"},
|
| 67 |
-
files={"fileToUpload": file}
|
| 68 |
-
)
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
def master_pipeline(sketch_1, sketch_2, image_prompt, video_prompt, ctrl_scale, consistency):
|
| 76 |
if not LUMA_API_KEY:
|
|
|
|
| 59 |
# PHASE 2: CPU ORCHESTRATION (API & UI)
|
| 60 |
# ==========================================
|
| 61 |
def upload_to_web(image):
|
| 62 |
+
filename = f"temp_frame_{int(time.time() * 1000)}.jpg"
|
| 63 |
+
image.convert("RGB").save(filename, format="JPEG", quality=90)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
+
try:
|
| 66 |
+
with open(filename, "rb") as file:
|
| 67 |
+
# Added a 30-second timeout so the app doesn't freeze if the server is slow
|
| 68 |
+
response = requests.post(
|
| 69 |
+
"https://freeimage.host/api/1/upload",
|
| 70 |
+
data={
|
| 71 |
+
"key": "6d207e02198a847aa98d0a2a901485a5",
|
| 72 |
+
"action": "upload"
|
| 73 |
+
},
|
| 74 |
+
files={"source": file},
|
| 75 |
+
timeout=30
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
if os.path.exists(filename):
|
| 79 |
+
os.remove(filename)
|
| 80 |
+
|
| 81 |
+
return response.json()["image"]["url"]
|
| 82 |
+
|
| 83 |
+
except requests.exceptions.Timeout:
|
| 84 |
+
raise gr.Error("☁️ Image host took too long to respond. Please try again.")
|
| 85 |
+
except Exception as e:
|
| 86 |
+
raise gr.Error(f"☁️ Image upload failed: {str(e)}")
|
| 87 |
|
| 88 |
def master_pipeline(sketch_1, sketch_2, image_prompt, video_prompt, ctrl_scale, consistency):
|
| 89 |
if not LUMA_API_KEY:
|