debisoft commited on
Commit
fe83398
·
1 Parent(s): 434a699
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -161,7 +161,8 @@ def sample_ddim(n_sample, n=20):
161
  intermediate = np.stack(intermediate)
162
  return samples, intermediate
163
 
164
- def greet(steps):
 
165
  samples, intermediate = sample_ddim(32, n=steps)
166
  #response = transform2(transform(np.moveaxis(samples.detach().cpu().numpy(),1,3)[-1]))
167
  #response2 = transform2(transform(np.moveaxis(samples.detach().cpu().numpy(),1,3)[1]))
@@ -181,6 +182,6 @@ transform2 = transforms.ToPILImage()
181
 
182
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Text to find entities", lines=2)], outputs=[gr.HighlightedText(label="Text with entities")], title="NER with dslim/bert-base-NER", description="Find entities using the `dslim/bert-base-NER` model under the hood!", allow_flagging="never", examples=["My name is Andrew and I live in California", "My name is Poli and work at HuggingFace"])
183
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Co-Retailing Business")], outputs=[gr.outputs.Image(type="pil", width=64, label="Output Image"), gr.outputs.Image(type="pil", width=64, label="Output Image2"), gr.outputs.Image(type="pil", width=64, label="Output Image3"), gr.outputs.Image(type="pil", width=64, label="Output Image4")])
184
- iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Steps", value=100)], outputs=[gr.Textbox(label="Info"), gr.Image(type="pil", width=64, label="Output Image"), gr.Image(type="pil", width=64, label="Output Image2"), gr.Image(type="pil", width=64, label="Output Image3"), gr.Image(type="pil", width=64, label="Output Image4")])
185
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Co-Retailing Business")], outputs=[gr.Textbox()])
186
  iface.launch()
 
161
  intermediate = np.stack(intermediate)
162
  return samples, intermediate
163
 
164
+ def greet(input):
165
+ steps = int(input)
166
  samples, intermediate = sample_ddim(32, n=steps)
167
  #response = transform2(transform(np.moveaxis(samples.detach().cpu().numpy(),1,3)[-1]))
168
  #response2 = transform2(transform(np.moveaxis(samples.detach().cpu().numpy(),1,3)[1]))
 
182
 
183
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Text to find entities", lines=2)], outputs=[gr.HighlightedText(label="Text with entities")], title="NER with dslim/bert-base-NER", description="Find entities using the `dslim/bert-base-NER` model under the hood!", allow_flagging="never", examples=["My name is Andrew and I live in California", "My name is Poli and work at HuggingFace"])
184
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Co-Retailing Business")], outputs=[gr.outputs.Image(type="pil", width=64, label="Output Image"), gr.outputs.Image(type="pil", width=64, label="Output Image2"), gr.outputs.Image(type="pil", width=64, label="Output Image3"), gr.outputs.Image(type="pil", width=64, label="Output Image4")])
185
+ iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Steps", value=500)], outputs=[gr.Textbox(label="Info"), gr.Image(type="pil", width=64, label="Output Image"), gr.Image(type="pil", width=64, label="Output Image2"), gr.Image(type="pil", width=64, label="Output Image3"), gr.Image(type="pil", width=64, label="Output Image4")])
186
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Co-Retailing Business")], outputs=[gr.Textbox()])
187
  iface.launch()