WYBar commited on
Commit
3f0a7c9
·
1 Parent(s): bcae552

Add application file

Browse files
Files changed (2) hide show
  1. app.py +10 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
5
+
6
+ def analyze(text):
7
+ result = model(text)[0]
8
+ return f"Label: {result['label']}, Score: {round(result['score'], 3)}"
9
+
10
+ gr.Interface(fn=analyze, inputs="text", outputs="text").launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch