Spaces:
Sleeping
Sleeping
| 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() | |