ilyi
Refine Gradio App.
da43dfa
raw
history blame contribute delete
902 Bytes
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()