Spaces:
Sleeping
Sleeping
File size: 1,070 Bytes
7b58366 7e7d672 7b58366 7e7d672 7b58366 7e7d672 7b58366 7e7d672 7b58366 7e7d672 7b58366 7e7d672 7b58366 7e7d672 7b58366 7e7d672 7b58366 |
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 36 37 38 39 |
import gradio as gr
from generate_prediction import generate_prediction
theme = gr.themes.Default(
primary_hue="stone",
secondary_hue="blue",
neutral_hue="zinc",
spacing_size="md",
text_size="md",
font=[gr.themes.GoogleFont("IBM Plex Mono"), "system-ui"]
)
def predict_image(image):
# Save the uploaded image to /image.jpeg
image_path = "./image.jpeg"
image.save(image_path)
# Call your model's prediction function
prediction = generate_prediction(image_path) # Assuming load_and_predict function exists in your model file
return prediction
with gr.Blocks(theme=theme) as demo:
# DEFINE COMPONENTS
gr.Markdown("# MindReader Quantum")
# Uploading the image input
with gr.Row():
image_input = gr.Image(type="pil", label="Upload Image")
output_label = gr.Label(label="Prediction")
# Button to submit and show the prediction
with gr.Row():
submit_btn = gr.Button("Submit")
submit_btn.click(fn=predict_image, inputs=image_input, outputs=output_label)
demo.launch()
|