transformers_js_py import gradio as gr from transformers_js import import_transformers_js transformers = await import_transformers_js() MODEL_ID = "ATHARVA596/learn_hf_food_not_food_text_classifier-distilbert-base-uncased" async def classify_text(text: str): pipeline = transformers.pipeline classifier = await pipeline("text-classification", MODEL_ID) result = await classifier(text, top_k=2) return result examples = [ "A delicious plate of pasta and salad.", "I wrote a Python script and fixed the bug in the code.", ] demo = gr.Interface( fn=classify_text, inputs=gr.Textbox(lines=5, label="Sentence"), outputs=gr.Label(num_top_classes=2), title="🍽️ Food or Not Food", description="Detect whether a sentence is about food or not food using the DistilBERT model from Hugging Face.", examples=examples, ) demo.launch()