Gabolozano commited on
Commit
c21a752
·
verified ·
1 Parent(s): 03e6add

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -1,7 +1,25 @@
1
  import gradio as gr
2
 
3
- def image_classifier(inp):
4
- return {'cat': 0.3, 'dog': 0.7}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
7
  demo.launch()
 
1
  import gradio as gr
2
 
3
+ #def image_classifier(inp):
4
+ # return {'cat': 0.3, 'dog': 0.7}
5
+
6
+ def get_pipeline_prediction(pil_image):
7
+ # first get the pipeline output given the pil image
8
+ pipeline_output = od_pipe(pil_image)
9
+
10
+ #Then process the image using the pipeline output
11
+ processed_image = render_results_in_image(pil_image,
12
+ pipeline_output)
13
+ return processed_image
14
+
15
+ demo = gr.Interface(
16
+ fn=get_pipeline_prediction,
17
+ inputs=gr.Image(label="Input image",
18
+ type="pil"),
19
+ outputs=gr.Image(label="Output image with predicted instances",
20
+ type="pil")
21
+ )
22
+
23
 
24
  demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
25
  demo.launch()