pengdaqian commited on
Commit
44f1fd6
1 Parent(s): 702657d
Files changed (3) hide show
  1. app.py +3 -3
  2. model.py +8 -0
  3. requirements.txt +2 -1
app.py CHANGED
@@ -4,7 +4,7 @@ import gradio as gr
4
  from datasets import load_dataset
5
  from PIL import Image
6
 
7
- from model import get_sd_small
8
  from trans_google import google_translator
9
 
10
  from i18n import i18nTranslator
@@ -43,7 +43,7 @@ samplers = [
43
  rand = random.Random()
44
  translator = google_translator()
45
 
46
- pipe = get_sd_small()
47
 
48
 
49
  def infer(prompt: str, negative: str, width: int, height: int, sampler: str, steps: int, seed: int, scale):
@@ -133,7 +133,7 @@ css = """
133
  padding-top: 1.5rem;
134
  }
135
  #prompt-column {
136
- min-height: 450px
137
  }
138
  #gallery {
139
  min-height: 22rem;
 
4
  from datasets import load_dataset
5
  from PIL import Image
6
 
7
+ from model import get_sd_small, get_sd_tiny
8
  from trans_google import google_translator
9
 
10
  from i18n import i18nTranslator
 
43
  rand = random.Random()
44
  translator = google_translator()
45
 
46
+ pipe = get_sd_tiny()
47
 
48
 
49
  def infer(prompt: str, negative: str, width: int, height: int, sampler: str, steps: int, seed: int, scale):
 
133
  padding-top: 1.5rem;
134
  }
135
  #prompt-column {
136
+ min-height: 500px
137
  }
138
  #gallery {
139
  min-height: 22rem;
model.py CHANGED
@@ -3,6 +3,7 @@ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler, DPMSolver
3
  OnnxStableDiffusionPipeline
4
 
5
  import pipeline_openvino_stable_diffusion
 
6
 
7
 
8
  def get_sd_21():
@@ -39,3 +40,10 @@ def get_sd_small():
39
  )
40
  pipe = pipeline_openvino_stable_diffusion.OpenVINOStableDiffusionPipeline.from_onnx_pipeline(onnx_pipe)
41
  return pipe
 
 
 
 
 
 
 
 
3
  OnnxStableDiffusionPipeline
4
 
5
  import pipeline_openvino_stable_diffusion
6
+ from optimum.intel.openvino import OVStableDiffusionPipeline
7
 
8
 
9
  def get_sd_21():
 
40
  )
41
  pipe = pipeline_openvino_stable_diffusion.OpenVINOStableDiffusionPipeline.from_onnx_pipeline(onnx_pipe)
42
  return pipe
43
+
44
+
45
+ def get_sd_tiny():
46
+ pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/stable-diffusion-2-1-quantized", compile=False)
47
+ pipe.reshape(batch_size=1, height=512, width=512, num_images_per_prompt=1)
48
+ pipe.compile()
49
+ return pipe
requirements.txt CHANGED
@@ -8,4 +8,5 @@ onnx
8
  openvino
9
  onnxruntime-openvino
10
  ftfy
11
- py-cpuinfo
 
 
8
  openvino
9
  onnxruntime-openvino
10
  ftfy
11
+ py-cpuinfo
12
+ optimum-intel[openvino, diffusers]