File size: 1,061 Bytes
494f436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import os
from demos.food_not_food_text_classifier.app_utility import gradio_food_classifier

description = """

A text classifier to determine if a sentence is about food or not food.



Fine-tuned from [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) on a [small dataset of food and not food text](https://huggingface.co/datasets/mrdbourke/learn_hf_food_not_food_image_captions).



See [source code](https://github.com/mrdbourke/learn-huggingface/blob/main/notebooks/hugging_face_text_classification_tutorial.ipynb).

"""

demo = gr.Interface(fn=gradio_food_classifier,
             inputs="text",
             outputs=gr.Label(num_top_classes=2),
             title="πŸ—πŸš«πŸ₯‘ Food or Not Food Text Classifier App",
             description=description,
             examples=[["I whipped up a fresh batch of code, but it seems to have a syntax error."],
                       ["A delicious photo of a plate of scrambled eggs, bacon and toast."]])


if __name__ == "__main__":
    demo.launch()