ICGenAIShare04 commited on
Commit
2015b5e
·
verified ·
1 Parent(s): 66c8799

bulletproof telegraph mate, gemini levels

Browse files

asked 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.

Files changed (1) hide show
  1. app.py +24 -11
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
- image.save("temp_frame.png")
63
- with open("temp_frame.png", "rb") as file:
64
- response = requests.post(
65
- "https://catbox.moe/user/api.php",
66
- data={"reqtype": "fileupload"},
67
- files={"fileToUpload": file}
68
- )
69
 
70
- if response.status_code == 200:
71
- return response.text.strip() # Catbox returns the direct URL as raw text
72
- else:
73
- raise gr.Error("☁️ Failed to upload image to Catbox.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: