wangli commited on
Commit
308351b
1 Parent(s): c05a272

feat: init

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +15 -0
  3. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .idea/
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(task="text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
5
+
6
+ def predict(text):
7
+ predictions = pipeline(text)
8
+ return {p["label"]: p["score"] for p in predictions}
9
+
10
+ gr.Interface(
11
+ predict,
12
+ inputs="text",
13
+ outputs=gr.outputs.Label(num_top_classes=5),
14
+ title="Text Classification",
15
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch