File size: 1,494 Bytes
db12d78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from predict import image_identity
import gradio as gr
import os

with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as iface:
    logo_url = os.path.join(os.path.dirname(__file__), "images/logo.png")
    # Displaying the logo
    with gr.Row(elem_classes="center-image"):
        gr.Image(logo_url, show_label=False, show_download_button=False,
                 show_share_button=False)
    iface_main = gr.Interface(image_identity,
                         inputs = gr.Image(label="Upload your image"),  # Adding a label to the input
                         outputs = [gr.Image(type="numpy", label="Predicted bin"), gr.Textbox(label="Prediction 1"),
                          gr.Textbox(label="Probability"),
                          gr.Textbox(label="Prediction 2"), gr.Textbox(label="Probability"),
                          gr.Textbox(label="Prediction Time")],
                         # Adding a description
                         description="This application is an image recognition app that identifies recyclable objects and provides feedback on the appropriate bin for waste disposal.",
                         examples=[['images/bottle2.jpg'],
                                   ['images/can2.jpg'],
                                   ['images/wine2.jpg'],
                                   ['images/compost2.jpg']],
                         cache_examples=False)  # Disabling caching



if __name__ == "__main__":
    # Launch the interface
    iface.launch(share=False)