Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -124,7 +124,7 @@ def unified_image_generator(prompt: str, images: Optional[List[str]], previous_v
|
|
124 |
contents.append(prompt)
|
125 |
response = client.models.generate_content(model=GEMINI_MODEL_NAME, contents=contents)
|
126 |
image_data = _extract_image_data_from_response(response)
|
127 |
-
if not image_data: raise gr.Error("No image data in response
|
128 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp:
|
129 |
Image.open(BytesIO(image_data)).save(tmp.name)
|
130 |
output_path = tmp.name
|
@@ -138,7 +138,7 @@ def unified_image_generator(prompt: str, images: Optional[List[str]], previous_v
|
|
138 |
|
139 |
return (output_path, gr.update(visible=can_create_video), gr.update(visible=can_extend_video), gr.update(visible=False))
|
140 |
except Exception as e:
|
141 |
-
raise gr.Error(f"Image generation failed: {e}")
|
142 |
|
143 |
def create_new_video(input_image_gallery: List[str], prompt_input: str, output_image: str, oauth_token: Optional[gr.OAuthToken]) -> tuple:
|
144 |
if not verify_pro_status(oauth_token): raise gr.Error("Access Denied.")
|
|
|
124 |
contents.append(prompt)
|
125 |
response = client.models.generate_content(model=GEMINI_MODEL_NAME, contents=contents)
|
126 |
image_data = _extract_image_data_from_response(response)
|
127 |
+
if not image_data: raise gr.Error("No image data in response")
|
128 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp:
|
129 |
Image.open(BytesIO(image_data)).save(tmp.name)
|
130 |
output_path = tmp.name
|
|
|
138 |
|
139 |
return (output_path, gr.update(visible=can_create_video), gr.update(visible=can_extend_video), gr.update(visible=False))
|
140 |
except Exception as e:
|
141 |
+
raise gr.Error(f"Image generation failed: {e}. Rephrase your prompt to make image generation explicit and try again")
|
142 |
|
143 |
def create_new_video(input_image_gallery: List[str], prompt_input: str, output_image: str, oauth_token: Optional[gr.OAuthToken]) -> tuple:
|
144 |
if not verify_pro_status(oauth_token): raise gr.Error("Access Denied.")
|