weifeng-chen commited on
Commit
6cf932e
β€’
1 Parent(s): 5905366

use interface

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,9 +4,9 @@ from diffusers import StableDiffusionPipeline
4
 
5
 
6
  device="cuda"
7
- model_id = "IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1"
8
 
9
- pipe_text2img = StableDiffusionPipeline.from_pretrained(model_id).to(device)
 
10
 
11
  def resize(w_val,l_val,img):
12
  img = Image.open(img)
@@ -15,7 +15,8 @@ def resize(w_val,l_val,img):
15
 
16
 
17
  def infer(prompt, guide, steps, width, height):
18
- output = pipe_text2img(prompt, guidance_scale=guide, num_inference_steps=steps, width=width, height=height)
 
19
  image = output.images[0]
20
  return image
21
 
 
4
 
5
 
6
  device="cuda"
 
7
 
8
+ # pipe_text2img = StableDiffusionPipeline.from_pretrained(model_id).to(device)
9
+ io1_text2img = gr.Interface.load("models/IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1")
10
 
11
  def resize(w_val,l_val,img):
12
  img = Image.open(img)
 
15
 
16
 
17
  def infer(prompt, guide, steps, width, height):
18
+
19
+ output = io1_text2img(prompt, guidance_scale=guide, num_inference_steps=steps, width=width, height=height)
20
  image = output.images[0]
21
  return image
22