wifix199 commited on
Commit
bffe78e
·
verified ·
1 Parent(s): 0b70041

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
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
- image = pipe(prompt).images[0]
 
 
 
 
 
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)