debisoft commited on
Commit
8779074
·
1 Parent(s): ed61215
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -166,11 +166,13 @@ def greet(input):
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]))
168
  #response = im.fromarray(intermediate[24][0][1]).convert("RGB")
169
- response = transform2(transform(np.moveaxis(intermediate,2,4)[0][0]))
170
- response2 = transform2(transform(np.moveaxis(intermediate,2,4)[0][10]))
171
- response3 = transform2(transform(np.moveaxis(intermediate,2,4)[0][20]))
172
- response4 = transform2(transform(np.moveaxis(intermediate,2,4)[4][30]))
173
- return response, response2, response3, response4
 
 
174
 
175
  transform2 = transforms.ToPILImage()
176
 
@@ -179,6 +181,6 @@ transform2 = transforms.ToPILImage()
179
 
180
  #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"])
181
  #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")])
182
- iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Co-Retailing Business")], outputs=[gr.Image(type="pil", width=64, label="Output Image"), gr.outputs.Image(type="pil", label="Output Image2"), gr.outputs.Image(type="pil", label="Output Image3"), gr.outputs.Image(type="pil", label="Output Image4")])
183
  #iface = gr.Interface(fn=greet, inputs=[gr.Textbox(label="Co-Retailing Business")], outputs=[gr.Textbox()])
184
  iface.launch()
 
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]))
168
  #response = im.fromarray(intermediate[24][0][1]).convert("RGB")
169
+ response = intermediate.shape;
170
+ response2 = transform2(transform(np.moveaxis(intermediate,2,4)[0][-1]))
171
+ response3 = transform2(transform(np.moveaxis(intermediate,2,4)[10][-1]))
172
+ response4 = transform2(transform(np.moveaxis(intermediate,2,4)[20][-1]))
173
+ response5 = transform2(transform(np.moveaxis(intermediate,2,4)[24][-1]))
174
+
175
+ return response, response2, response3, response4, response5
176
 
177
  transform2 = transforms.ToPILImage()
178
 
 
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="Co-Retailing Business")], 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()