Spaces:
Sleeping
Sleeping
File size: 532 Bytes
661cf1b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import gradio as gr
from transformers import pipeline
# Load your model from the Hugging Face Hub
classifier = pipeline("text-classification", model="LunarEcho1/my-food-classifier")
# Inference function
def classify(text):
prediction = classifier(text)[0]
label = prediction["label"]
score = round(prediction["score"], 3)
return f"{label} ({score})"
# Create the Gradio interface
demo = gr.Interface(fn=classify, inputs="text", outputs="text", title="🍔 Food or Not Classifier")
# Launch the app
demo.launch()
|