Change layout
Browse files
app.py
CHANGED
@@ -113,5 +113,28 @@ def _load_model(model_name: str):
|
|
113 |
model_finetuned.eval()
|
114 |
|
115 |
_load_model('ar_base.tar')
|
116 |
-
demo = gr.Interface(image_classifier, gr.inputs.Image(shape=(224,224)), [gr.outputs.Label(label="Our Classification", num_top_classes=3), gr.Image(label="Our Relevance",shape=(64,64)), gr.outputs.Label(label="Original Classification", num_top_classes=3), gr.Image(label="Original Relevance",shape=(64,64))],examples=["samples/augreg_base/tank.png", "samples/augreg_base/sundial.png", "samples/augreg_base/lizard.png", "samples/augreg_base/storck.png", "samples/augreg_base/hummingbird2.png", "samples/augreg_base/hummingbird.png"], capture_session=True
|
117 |
-
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
model_finetuned.eval()
|
114 |
|
115 |
_load_model('ar_base.tar')
|
116 |
+
#demo = gr.Interface(image_classifier, gr.inputs.Image(shape=(224,224)), [gr.outputs.Label(label="Our Classification", num_top_classes=3), gr.Image(label="Our Relevance",shape=(64,64)), gr.outputs.Label(label="Original Classification", num_top_classes=3), gr.Image(label="Original Relevance",shape=(64,64))],examples=["samples/augreg_base/tank.png", "samples/augreg_base/sundial.png", "samples/augreg_base/lizard.png", "samples/augreg_base/storck.png", "samples/augreg_base/hummingbird2.png", "samples/augreg_base/hummingbird.png"], capture_session=True)
|
117 |
+
#demo.launch(debug=True)
|
118 |
+
|
119 |
+
demo = gr.Blocks()
|
120 |
+
|
121 |
+
with demo:
|
122 |
+
gr.Markdown('Select an image and then click **submit** to see the output.')
|
123 |
+
|
124 |
+
with gr.Row():
|
125 |
+
inp = gr.inputs.Image(shape=(224,224))
|
126 |
+
|
127 |
+
outs = []
|
128 |
+
with gr.Row():
|
129 |
+
out1 = gr.outputs.Label(label="Our Classification", num_top_classes=3)
|
130 |
+
out2 = gr.Image(label="Our Relevance",shape=(224,224))
|
131 |
+
|
132 |
+
with gr.Row():
|
133 |
+
out3 = gr.outputs.Label(label="Original Classification", num_top_classes=3)
|
134 |
+
out4 = gr.Image(label="Original Relevance",shape=(224,224))
|
135 |
+
|
136 |
+
btn = gr.Button('Submit')
|
137 |
+
btn.click(fn=image_classifier, inputs=inp, outputs=[out1, out2, out3, out4])
|
138 |
+
|
139 |
+
demo.launch()
|
140 |
+
|