yuvaranianandhan24 commited on
Commit
d2898bf
·
verified ·
1 Parent(s): b3146b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -8,6 +8,8 @@ from langchain import HuggingFaceHub
8
 
9
  from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
10
  import torch
 
 
11
 
12
 
13
  # Suppressing all warnings
@@ -68,13 +70,14 @@ def txt2speech(text):
68
 
69
  # text-to- image
70
  def txt2img(text, style="realistic"):
71
- model_id = "stabilityai/stable-diffusion-2"
 
72
 
73
  # Use the Euler scheduler here instead
74
- scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
75
- pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
76
  #pipe = pipe.to("cuda")
77
- image = pipe(prompt = text, guidance_scale = 7.5).images[0]
78
  return image
79
 
80
 
 
8
 
9
  from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
10
  import torch
11
+ from diffusers import DiffusionPipeline
12
+
13
 
14
 
15
  # Suppressing all warnings
 
70
 
71
  # text-to- image
72
  def txt2img(text, style="realistic"):
73
+ #model_id = "stabilityai/stable-diffusion-2"
74
+ pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
75
 
76
  # Use the Euler scheduler here instead
77
+ #scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
78
+ #pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
79
  #pipe = pipe.to("cuda")
80
+ image = pipeline(prompt = text, guidance_scale = 7.5).images[0]
81
  return image
82
 
83