Uploading food not food text classifier demo app.py
Browse files
app.py
CHANGED
@@ -25,19 +25,12 @@ def food_not_food_classifier(text: str) -> Dict[str, float]:
|
|
25 |
return output_dict
|
26 |
|
27 |
# 3. Create a Gradio interface with details about our app
|
28 |
-
description = """
|
29 |
-
A text classifier to determine if a sentence is about food or not food.
|
30 |
-
|
31 |
-
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).
|
32 |
-
|
33 |
-
See [source code](https://github.com/mrdbourke/learn-huggingface/blob/main/notebooks/hugging_face_text_classification_tutorial.ipynb).
|
34 |
-
"""
|
35 |
|
36 |
demo = gr.Interface(fn=food_not_food_classifier,
|
37 |
inputs="text",
|
38 |
outputs=gr.Label(num_top_classes=2), # show top 2 classes (that's all we have)
|
39 |
-
title="
|
40 |
-
description=
|
41 |
examples=[["I whipped up a fresh batch of code, but it seems to have a syntax error."],
|
42 |
["A delicious photo of a plate of scrambled eggs, bacon and toast."]])
|
43 |
|
|
|
25 |
return output_dict
|
26 |
|
27 |
# 3. Create a Gradio interface with details about our app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
demo = gr.Interface(fn=food_not_food_classifier,
|
30 |
inputs="text",
|
31 |
outputs=gr.Label(num_top_classes=2), # show top 2 classes (that's all we have)
|
32 |
+
title="Food or Not Food Text Classifier",
|
33 |
+
description="一个用于判断句子是否与食物相关的文本分类器(食物/非食物二分类)",
|
34 |
examples=[["I whipped up a fresh batch of code, but it seems to have a syntax error."],
|
35 |
["A delicious photo of a plate of scrambled eggs, bacon and toast."]])
|
36 |
|