Spaces:
Sleeping
Sleeping
File size: 958 Bytes
0499d90 ff2d287 0499d90 ff2d287 fc68f43 ff2d287 0499d90 ff2d287 6a1720d ff2d287 c6c3058 ff2d287 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from transformers import pipeline
# Load the model for food classification
food_classifier = pipeline(task="image-classification", model="mhdiqbalpradipta/minang_food_classification")
def predict_food(image):
# Perform prediction using the model
result = food_classifier(images=image)[0]
# Save label and score
food_label = result['label']
score = result['score']
return f"Food: {food_label}, Score: {score:.2f}"
# Gradio Interface
image_in = gr.Image(type='pil')
label_out = "text"
example_images = ['ayam_goreng.jpg', 'ayam_pop.jpg', 'daging_rendang.jpg', 'dendeng_batokok.jpg', 'gulai_ikan.jpg', 'gulai_tambusu.jpg', 'gulai_tunjang.jpg', 'telur_balado.jpg', 'telur_dadar.jpg']
intf = gr.Interface(fn=predict_food, inputs=image_in, outputs=label_out, examples=example_images, title="Minang Food Classifier", description="Upload an image of food to classify it into Minang dishes.")
intf.launch(share=False); |