jclyo1 commited on
Commit
621839f
1 Parent(s): 8ba460b
Files changed (1) hide show
  1. main.py +5 -2
main.py CHANGED
@@ -19,7 +19,9 @@ app = FastAPI()
19
 
20
  @app.get("/generate")
21
  def generate_image(prompt):
22
- model_id = "stabilityai/stable-diffusion-2-1" #CompVis/stable-diffusion-v1-4
 
 
23
 
24
  # Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
25
  #pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
@@ -29,7 +31,8 @@ def generate_image(prompt):
29
 
30
  #prompt = "a photo of an astronaut riding a horse on mars"
31
 
32
- image = pipe(prompt, num_inference_steps=5).images[0]
 
33
 
34
  print(image)
35
  image.save("static/ai.jpg")
 
19
 
20
  @app.get("/generate")
21
  def generate_image(prompt):
22
+ print(f"Is CUDA available: {torch.cuda.is_available()}")
23
+
24
+ model_id = "CompVis/stable-diffusion-v1-4" #stabilityai/stable-diffusion-2-1
25
 
26
  # Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
27
  #pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
 
31
 
32
  #prompt = "a photo of an astronaut riding a horse on mars"
33
 
34
+ #image = pipe(prompt, num_inference_steps=5).images[0]
35
+ image = pipe(prompt).images[0]
36
 
37
  print(image)
38
  image.save("static/ai.jpg")