ajinkyakolhe112 commited on
Commit
d5f7570
·
verified ·
1 Parent(s): d768e95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -21,9 +21,25 @@ def predict(inp):
21
 
22
  import gradio as gr
23
 
24
- gr.Interface(fn=predict,
25
- inputs=gr.Image(type="pil"),
26
- outputs=gr.Label(num_top_classes=3),
27
- examples=["lion.jpg", "cheetah.jpg"]).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  demo.launch()
 
21
 
22
  import gradio as gr
23
 
24
+ with gr.Blocks(title="Image Classification for 1000 Objects",
25
+ css=".gradio-container {background:mintcream;}"
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
+ with gr.Row():
30
+ input_image = gr.Image(type="filepath", image_mode="L", shape=(224, 224))
31
+ output_label = gr.Label(label="Probabilities", num_top_classes=3)
32
+
33
+ send_btn = gr.Button("Infer")
34
+ send_btn.click(fn=predict, inputs=input_image, outputs=output_label)
35
+
36
+ with gr.Row():
37
+ gr.Examples(['./lion.jpg'] , label='Sample images : Lion', inputs=input_image)
38
+ gr.Examples(['./cheetah.jpg'], label='Cheetah' , inputs=input_image)
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()