Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import transformers
|
2 |
+
from huggingface_hub import notebook_login
|
3 |
+
from datasets import load_dataset
|
4 |
+
from transformers import AutoModelForSequenceClassification
|
5 |
+
model = AutoModelForSequenceClassification.from_pretrained("DioLiu/autotrain-koles_score2-3525195294")
|
6 |
+
from transformers import AutoTokenizer
|
7 |
+
model_checkpoint = "distilbert-base-uncased"
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("DioLiu/autotrain-koles_score2-3525195294")
|
9 |
+
from transformers import pipeline
|
10 |
+
import gradio as gr
|
11 |
+
from transformers import pipeline
|
12 |
+
|
13 |
+
classifier = pipeline("sentiment-analysis",model=model,tokenizer=tokenizer)
|
14 |
+
def get_sentiment(input_text):
|
15 |
+
return classifier(input_text)
|
16 |
+
|
17 |
+
iface = gr.Interface(fn= get_sentiment, inputs="text", outputs = ["text"], title="Sentiment Analysis")
|
18 |
+
iface.launch()
|