Update app.py
Browse files
app.py
CHANGED
@@ -50,16 +50,22 @@ except Exception as e:
|
|
50 |
def generate_image(prompt):
|
51 |
global pipeline
|
52 |
if pipeline is None:
|
|
|
53 |
return "Error: Model not loaded!"
|
54 |
|
55 |
try:
|
56 |
-
image
|
57 |
-
|
58 |
-
|
|
|
59 |
except Exception as e:
|
60 |
-
error_message = f"Error during image generation: {e}"
|
61 |
-
print(error_message)
|
62 |
-
return error_message # Return
|
|
|
|
|
|
|
|
|
63 |
|
64 |
# 5. Gradio interface
|
65 |
with gr.Blocks() as demo:
|
|
|
50 |
def generate_image(prompt):
|
51 |
global pipeline
|
52 |
if pipeline is None:
|
53 |
+
print("Error: Pipeline is None (model not loaded)") # Log this specifically
|
54 |
return "Error: Model not loaded!"
|
55 |
|
56 |
try:
|
57 |
+
print("Starting image generation...") # Log before the image generation
|
58 |
+
image = pipeline(prompt).images[0]
|
59 |
+
print("Image generated successfully!")
|
60 |
+
return image
|
61 |
except Exception as e:
|
62 |
+
error_message = f"Error during image generation: {type(e).__name__}: {e}" # Include exception type
|
63 |
+
print(f"Full Error Details:\n{error_message}") # Print full details
|
64 |
+
return error_message # Return error message to Gradio
|
65 |
+
except RuntimeError as re:
|
66 |
+
error_message = f"Runtime Error during image generation: {type(re).__name__}: {re}" # Include exception type
|
67 |
+
print(f"Full Runtime Error Details:\n{error_message}") # Print full details
|
68 |
+
return error_message # Return error message to Gradio
|
69 |
|
70 |
# 5. Gradio interface
|
71 |
with gr.Blocks() as demo:
|