Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,14 @@ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float
|
|
7 |
pipe.to("cpu") # Use "cuda" if GPU is available
|
8 |
|
9 |
def generate_image(prompt):
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
return image
|
|
|
12 |
def chatbot(prompt):
|
13 |
# Generate the image based on the user's input
|
14 |
image = generate_image(prompt)
|
|
|
7 |
pipe.to("cpu") # Use "cuda" if GPU is available
|
8 |
|
9 |
def generate_image(prompt):
|
10 |
+
# Ensure prompt is passed correctly
|
11 |
+
inputs = pipe.tokenizer(prompt, return_tensors="pt")
|
12 |
+
with torch.no_grad():
|
13 |
+
# Ensure inputs are provided correctly
|
14 |
+
output = pipe(prompt, **inputs)
|
15 |
+
image = output.images[0]
|
16 |
return image
|
17 |
+
|
18 |
def chatbot(prompt):
|
19 |
# Generate the image based on the user's input
|
20 |
image = generate_image(prompt)
|