Update app.py
Browse files
app.py
CHANGED
|
@@ -21,25 +21,23 @@ def predict(inp):
|
|
| 21 |
|
| 22 |
import gradio as gr
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
) as demo:
|
| 27 |
-
gr.HTML("""<div style="font-family:'Times New Roman', 'Serif'; font-size:16pt; font-weight:bold; text-align:center; color:royalblue;">Image Classification for 1000 Objects</div>""")
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
|
| 40 |
# gr.Interface(fn=predict,
|
| 41 |
# inputs=gr.Image(type="pil"),
|
| 42 |
# outputs=gr.Label(num_top_classes=3),
|
| 43 |
# examples=["lion.jpg", "cheetah.jpg"]).launch()
|
| 44 |
|
| 45 |
-
demo.launch()
|
|
|
|
| 21 |
|
| 22 |
import gradio as gr
|
| 23 |
|
| 24 |
+
demo = gr.Blocks(title="Image Classification for 1000 Objects", css=".gradio-container {background:mintcream;}")
|
| 25 |
+
gr.HTML("""<div style="font-family:'Times New Roman', 'Serif'; font-size:16pt; font-weight:bold; text-align:center; color:royalblue;">Image Classification for 1000 Objects</div>""")
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
with gr.Row():
|
| 28 |
+
input_image = gr.Image(type="filepath", image_mode="L", shape=(224, 224))
|
| 29 |
+
output_label = gr.Label(label="Probabilities", num_top_classes=3)
|
| 30 |
|
| 31 |
+
send_btn = gr.Button("Infer")
|
| 32 |
+
send_btn.click(fn=predict, inputs=input_image, outputs=output_label)
|
| 33 |
|
| 34 |
+
with gr.Row():
|
| 35 |
+
gr.Examples(['./lion.jpg'] , label='Sample images : Lion', inputs=input_image)
|
| 36 |
+
gr.Examples(['./cheetah.jpg'], label='Cheetah' , inputs=input_image)
|
| 37 |
|
| 38 |
# gr.Interface(fn=predict,
|
| 39 |
# inputs=gr.Image(type="pil"),
|
| 40 |
# outputs=gr.Label(num_top_classes=3),
|
| 41 |
# examples=["lion.jpg", "cheetah.jpg"]).launch()
|
| 42 |
|
| 43 |
+
demo.launch(debug=True)
|