Spaces:
Runtime error
Runtime error
measmonysuon
commited on
Commit
•
8e3960a
1
Parent(s):
2ee9133
Update app.py
Browse files
app.py
CHANGED
@@ -80,6 +80,8 @@ def gradio_interface(prompt, resolution_key, user_chat_id):
|
|
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)
|
@@ -111,6 +113,14 @@ def gradio_interface(prompt, resolution_key, user_chat_id):
|
|
111 |
# Always request to switch back hardware
|
112 |
api.request_space_hardware(repo_id='measmonysuon/DALLE-4K', hardware='zero-a10g')
|
113 |
logger.info("Hardware reset to Zero-A10G")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
def handle_generate_image(prompt, resolution_key, user_chat_id):
|
116 |
points = get_user_points(user_chat_id)
|
|
|
80 |
# Add a short delay to allow the hardware switch to complete
|
81 |
time.sleep(5) # Adjust this value if needed
|
82 |
|
83 |
+
gpu_info = {} # Initialize gpu_info to an empty dictionary
|
84 |
+
|
85 |
try:
|
86 |
# Generate the image
|
87 |
image_info, seed, gpu_info = generate_image(prompt, resolution_key)
|
|
|
113 |
# Always request to switch back hardware
|
114 |
api.request_space_hardware(repo_id='measmonysuon/DALLE-4K', hardware='zero-a10g')
|
115 |
logger.info("Hardware reset to Zero-A10G")
|
116 |
+
|
117 |
+
finally:
|
118 |
+
# Log GPU info before resetting hardware
|
119 |
+
logger.info(f"GPU info before reset: {gpu_info}")
|
120 |
+
|
121 |
+
# Always request to switch back hardware
|
122 |
+
api.request_space_hardware(repo_id='measmonysuon/DALLE-4K', hardware='zero-a10g')
|
123 |
+
logger.info("Hardware reset to Zero-A10G")
|
124 |
|
125 |
def handle_generate_image(prompt, resolution_key, user_chat_id):
|
126 |
points = get_user_points(user_chat_id)
|