Spaces:
Runtime error
Runtime error
measmonysuon
commited on
Commit
•
2ee9133
1
Parent(s):
cfe98b9
Update app.py
Browse files
app.py
CHANGED
@@ -79,16 +79,13 @@ def gradio_interface(prompt, resolution_key, user_chat_id):
|
|
79 |
|
80 |
# Add a short delay to allow the hardware switch to complete
|
81 |
time.sleep(5) # Adjust this value if needed
|
82 |
-
|
83 |
-
# Get GPU info
|
84 |
-
gpu_info = get_gpu_info()
|
85 |
|
86 |
try:
|
87 |
# Generate the image
|
88 |
-
|
89 |
|
90 |
-
if
|
91 |
-
file_path =
|
92 |
if file_path:
|
93 |
# Combine base URL with file path to create full URL
|
94 |
base_url = "https://measmonysuon-imagen.hf.space/file="
|
@@ -99,7 +96,7 @@ def gradio_interface(prompt, resolution_key, user_chat_id):
|
|
99 |
update_user_points(user_chat_id, -5)
|
100 |
notify_webhook_with_file(user_chat_id, full_file_url, gpu_info) # Notify webhook with full file URL
|
101 |
|
102 |
-
return full_file_url, f"Check your telegram, The image was generated successfully. {gpu_info}"
|
103 |
|
104 |
return None, "The image file is not available. Please try again later."
|
105 |
|
|
|
79 |
|
80 |
# Add a short delay to allow the hardware switch to complete
|
81 |
time.sleep(5) # Adjust this value if needed
|
|
|
|
|
|
|
82 |
|
83 |
try:
|
84 |
# Generate the image
|
85 |
+
image_info, seed, gpu_info = generate_image(prompt, resolution_key)
|
86 |
|
87 |
+
if image_info and image_info[0]:
|
88 |
+
file_path = image_info[0].get('image')
|
89 |
if file_path:
|
90 |
# Combine base URL with file path to create full URL
|
91 |
base_url = "https://measmonysuon-imagen.hf.space/file="
|
|
|
96 |
update_user_points(user_chat_id, -5)
|
97 |
notify_webhook_with_file(user_chat_id, full_file_url, gpu_info) # Notify webhook with full file URL
|
98 |
|
99 |
+
return full_file_url, f"Check your telegram, The image was generated successfully. GPU Info: {json.dumps(gpu_info)}"
|
100 |
|
101 |
return None, "The image file is not available. Please try again later."
|
102 |
|