Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -68,17 +68,53 @@ title = "Smartathon Phase2 Demo - Baseer"
|
|
68 |
description = "This demo introduces an interactive playground for our trained Detectron2 model."
|
69 |
article = '<p>Detectron model is available from our repository <a href="https://github.com/asalhi/Smartathon-Baseer">here</a>.</p>'
|
70 |
|
71 |
-
gr.Interface(
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
description = "This demo introduces an interactive playground for our trained Detectron2 model."
|
69 |
article = '<p>Detectron model is available from our repository <a href="https://github.com/asalhi/Smartathon-Baseer">here</a>.</p>'
|
70 |
|
71 |
+
# gr.Interface(
|
72 |
+
# inference,
|
73 |
+
# [gr.inputs.Textbox(label="Image URL", placeholder=""),
|
74 |
+
# gr.inputs.Image(type="filepath", image_mode="RGB", source="upload", optional=False, label="Input Image"),
|
75 |
+
# gr.Slider(minimum=0.0, maximum=1.0, value=0.4, label="Minimum score"),
|
76 |
+
# ],
|
77 |
+
# gr.outputs.Image(type="pil", label="Output"),
|
78 |
+
# #gr.Examples(['./d1.jpeg', './d2.jpeg', './d3.jpeg','./d4.jpeg','./d5.jpeg','./d6.jpeg'], inputs=gr.inputs.Image(type="filepath", image_mode="RGB", source="upload", optional=False, label="Input Image")),
|
79 |
+
# title=title,
|
80 |
+
# description=description,
|
81 |
+
# article=article,
|
82 |
+
# #examples=[['./d1.jpeg'], ['./d2.jpeg'], ['./d3.jpeg'],['./d4.jpeg'],['./d5.jpeg'],['./d6.jpeg']],
|
83 |
+
# examples = gr.Examples(['./d1.jpeg', './d2.jpeg', './d3.jpeg','./d4.jpeg','./d5.jpeg','./d6.jpeg'], inputs=gr.inputs.Image(type="filepath", image_mode="RGB", source="upload", optional=False, label="Input Image")),
|
84 |
+
# cache_examples=False).launch()
|
85 |
+
# #examples=['./d1.jpeg', './d2.jpeg', './d3.jpeg','./d4.jpeg','./d5.jpeg','./d6.jpeg']
|
86 |
+
|
87 |
+
|
88 |
+
with gr.Blocks(title=title,
|
89 |
+
description=description,
|
90 |
+
article=article
|
91 |
+
) as demo:
|
92 |
+
|
93 |
+
# gr.HTML("""<div style="font-family:'Times New Roman', 'Serif'; font-size:16pt; font-weight:bold; text-align:center; color:royalblue;">Detectron2 Object Detection</div>""")
|
94 |
+
#
|
95 |
+
# gr.HTML("""<h4 style="color:navy;">1-a. Select an example by clicking a thumbnail below.</h4>""")
|
96 |
+
#
|
97 |
+
# gr.HTML("""<h4 style="color:navy;">1-b. Or upload an image by clicking on the canvas.</h4>""")
|
98 |
+
|
99 |
+
with gr.Row():
|
100 |
+
input_url = gr.Textbox(label="Image URL", placeholder="")
|
101 |
+
input_image = gr.Image(type="filepath", image_mode="RGB", source="upload", optional=False, label="Input Image")
|
102 |
+
output_image = gr.Image(type="pil", label="Output")
|
103 |
+
|
104 |
+
gr.Examples(['./d1.jpeg', './d2.jpeg', './d3.jpeg','./d4.jpeg','./d5.jpeg','./d6.jpeg'], inputs=input_image)
|
105 |
+
|
106 |
+
# gr.HTML("""<br/>""")
|
107 |
+
# gr.HTML("""<h4 style="color:navy;">2. Then, click "Infer" button to predict object instances. It will take about 15-20 seconds (on cpu)</h4>""")
|
108 |
+
|
109 |
+
send_btn = gr.Button("Submit")
|
110 |
+
send_btn.click(fn=infer, inputs=[[input_url],[input_image]], outputs=[output_image])
|
111 |
+
|
112 |
+
# gr.HTML("""<br/>""")
|
113 |
+
# gr.HTML("""<h4 style="color:navy;">Reference</h4>""")
|
114 |
+
# gr.HTML("""<ul>""")
|
115 |
+
# gr.HTML("""<li><a href="https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5" target="_blank">Detectron2 Tutorial</a>""")
|
116 |
+
# gr.HTML("""</ul>""")
|
117 |
+
|
118 |
+
|
119 |
+
#demo.queue()
|
120 |
+
demo.launch() # debug=True)
|