tfwang commited on
Commit
dece341
1 Parent(s): ef28a59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -24,8 +24,7 @@ import numpy as np
24
  from huggingface_hub import hf_hub_download
25
 
26
  def run(image, mode, sample_c=1.3, num_samples=3, sample_step=100):
27
- device = torch.device("cuda") #if torch.cuda.is_available() else torch.device("cpu")
28
-
29
  parser, parser_up = create_argparser()
30
 
31
  args = parser.parse_args()
@@ -216,15 +215,14 @@ iface = gr.Interface(fn=run, inputs=[
216
  # gr.Image(image_mode="L", source="canvas", type="pil", shape=(256,256), invert_colors=False, tool="editor"),
217
  gr.inputs.Radio(label="Input Mode - The type of your input", choices=["mask", "sketch"],default="sketch"),
218
  gr.inputs.Slider(label="sample_c - The strength of classifier-free guidance",default=1.4, minimum=1.0, maximum=2.0),
219
- gr.inputs.Slider(label="Number of samples - How many samples you wish to generate", default=2, step=1, minimum=1, maximum=8),
220
- gr.inputs.Slider(label="Number of Steps - How many steps you want to use", default=100, step=10, minimum=10, maximum=1000),
221
  ],
222
  outputs=[image],
223
  css=css,
224
  title="Generate images from sketches with PITI",
225
  description="<div>By uploading a sketch map or a semantic map and pressing submit, you can generate images based on your input. As the computing device is CPU, the running may be slow.</div>",
226
- examples=[["1.png", "sketch", 1.3, 2, 100], ["2.png", "sketch", 1.3, 2, 100],["3.png", "sketch", 1.3, 2, 100],["4.png", "mask", 1.3, 2, 100],["5.png", "mask", 1.3, 2, 100],["6.png", "mask", 1.3, 2, 100]],
227
- cache_examples=False)
228
-
229
  iface.launch(enable_queue=True)
230
-
 
24
  from huggingface_hub import hf_hub_download
25
 
26
  def run(image, mode, sample_c=1.3, num_samples=3, sample_step=100):
27
+ device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
 
28
  parser, parser_up = create_argparser()
29
 
30
  args = parser.parse_args()
 
215
  # gr.Image(image_mode="L", source="canvas", type="pil", shape=(256,256), invert_colors=False, tool="editor"),
216
  gr.inputs.Radio(label="Input Mode - The type of your input", choices=["mask", "sketch"],default="sketch"),
217
  gr.inputs.Slider(label="sample_c - The strength of classifier-free guidance",default=1.4, minimum=1.0, maximum=2.0),
218
+ gr.inputs.Slider(label="Number of samples - How many samples you wish to generate", default=4, step=1, minimum=1, maximum=16),
219
+ gr.inputs.Slider(label="Number of Steps - How many steps you want to use", default=100, step=10, minimum=50, maximum=1000),
220
  ],
221
  outputs=[image],
222
  css=css,
223
  title="Generate images from sketches with PITI",
224
  description="<div>By uploading a sketch map or a semantic map and pressing submit, you can generate images based on your input. As the computing device is CPU, the running may be slow.</div>",
225
+ examples=[["1.png", "sketch", 1.3, 4, 100], ["2.png", "sketch", 1.3, 4, 100],["3.png", "sketch", 1.3, 4, 100],["4.png", "mask", 1.3, 4, 100],["5.png", "mask", 1.3, 4, 100],["6.png", "mask", 1.3, 4, 100]])
226
+
 
227
  iface.launch(enable_queue=True)
228
+