Spaces:
Sleeping
Sleeping
File size: 902 Bytes
a97d1bb da43dfa a97d1bb da43dfa |
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 31 32 33 34 35 |
import gradio as gr
from src.config import Config
from src.predict import predict
from gradio.components import Image, Label, Button
# Create a Gradio interface
image = gr.inputs.Image()
label = gr.outputs.Label(num_top_classes=1)
with gr.Blocks(theme='gradio/monochrome') as demo:
with gr.Row():
with open('src/assets/header.md', 'r', encoding='utf-8') as f:
header = gr.Markdown(f.read())
with gr.Row(align="center", align_items="center"):
input_image = Image(
label="Image",
interactive=True
)
output = Label(
num_top_classes=5,
label="Prediction"
)
with gr.Row():
predict_button = Button(value="Predict Animal", label="Predict", info="Click to make a prediction.")
predict_button.click(fn=predict, inputs=input_image, outputs=output)
demo.launch()
|