mrm8488 commited on
Commit
b0c5c4b
β€’
1 Parent(s): 90da81e

Set UI stuff

Browse files
Files changed (3) hide show
  1. __pycache__/ui.cpython-310.pyc +0 -0
  2. app.py +7 -4
  3. ui.py +13 -0
__pycache__/ui.cpython-310.pyc ADDED
Binary file (749 Bytes). View file
 
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from diffusers import DDPMPipeline
2
  import gradio as gr
 
3
 
4
 
5
 
@@ -10,11 +11,11 @@ models = [
10
  {'type': 'butterflies', 'res': 128, 'id': 'mrm8488/ddpm-ema-butterflies-128'},
11
  {'type': 'human_faces', 'res': 256, 'id': 'fusing/ddpm-celeba-hq'}
12
  ]
13
-
14
  for model in models:
15
  pipeline = DDPMPipeline.from_pretrained(model['id'])
16
  pipeline.save_pretrained(model['id'])
17
-
18
  def predict(type):
19
  model_id = None
20
  for model in models:
@@ -31,7 +32,9 @@ def predict(type):
31
 
32
  gr.Interface(
33
  predict,
34
- inputs=[gr.components.Dropdown(choices = [model['type'] for model in models], label='Models')
35
  ],
36
- outputs=["image"]
 
 
37
  ).launch()
 
1
  from diffusers import DDPMPipeline
2
  import gradio as gr
3
+ from ui import title, description, examples
4
 
5
 
6
 
 
11
  {'type': 'butterflies', 'res': 128, 'id': 'mrm8488/ddpm-ema-butterflies-128'},
12
  {'type': 'human_faces', 'res': 256, 'id': 'fusing/ddpm-celeba-hq'}
13
  ]
14
+ '''
15
  for model in models:
16
  pipeline = DDPMPipeline.from_pretrained(model['id'])
17
  pipeline.save_pretrained(model['id'])
18
+ '''
19
  def predict(type):
20
  model_id = None
21
  for model in models:
 
32
 
33
  gr.Interface(
34
  predict,
35
+ inputs=[gr.components.Dropdown(choices = [model['type'] for model in models], label='Choose a model')
36
  ],
37
+ outputs=["image"],
38
+ title=title,
39
+ description=description
40
  ).launch()
ui.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ title = "DDPM Diffusion models trained on Q-Blocks Demo"
2
+ description = """
3
+ <p>
4
+ <center>
5
+ Demo of DDPM Diffusion models trained using <a href='https://github.com/huggingface/diffusers' target='_blank'>HF/Diffusers library</a> on
6
+ <a href='https://www.qblocks.cloud/' target='_blank'><b>Q-Blocks</b></a> hardware.
7
+ <img src="https://raw.githubusercontent.com/huggingface/diffusers/main/docs/source/imgs/diffusers_library.jpg" alt="meta nllb pic" width="300"/>
8
+ <img alt="Imagen" draggable="true" src="https://pbs.twimg.com/profile_images/1393401965653204992/onkaGwZO_400x400.jpg" width="200">
9
+ </center>
10
+ </p>
11
+ """
12
+
13
+ examples = []