Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,16 +5,18 @@ from diffusers import AutoPipelineForText2Image
|
|
5 |
import gradio as gr
|
6 |
import base64
|
7 |
|
8 |
-
|
9 |
-
print("Loading the Stable Diffusion model...")
|
10 |
-
try:
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
def generate_image(prompt):
|
|
|
18 |
try:
|
19 |
if model is None:
|
20 |
raise ValueError("Model not loaded properly.")
|
|
|
5 |
import gradio as gr
|
6 |
import base64
|
7 |
|
8 |
+
def load_model():
|
9 |
+
print("Loading the Stable Diffusion model...")
|
10 |
+
try:
|
11 |
+
model = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo")
|
12 |
+
print("Model loaded successfully.")
|
13 |
+
return model
|
14 |
+
except Exception as e:
|
15 |
+
print(f"Error loading model: {e}")
|
16 |
+
return None
|
17 |
|
18 |
def generate_image(prompt):
|
19 |
+
model = load_model()
|
20 |
try:
|
21 |
if model is None:
|
22 |
raise ValueError("Model not loaded properly.")
|