Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,14 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
review = tokeniser.encode(review)
|
15 |
-
review = model.predict([review])
|
16 |
-
return int(review.logits.argmax())
|
17 |
-
|
18 |
-
iface = gr.Interface(review_classify,
|
19 |
-
title="Review Classification using DistilRoBERTa",
|
20 |
-
inputs=[gr.Text(label="Review")],
|
21 |
-
outputs=[gr.Number(label="Rating", precision=0)],
|
22 |
-
examples=[example_review])
|
23 |
iface.launch()
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
sentiment = pipeline('sentiment-analysis')
|
4 |
+
def get_sentiment(input_text):
|
5 |
+
return sentiment (input_text)
|
6 |
+
iface = gr.Interface(fn = get_sentiment,
|
7 |
+
inputs = 'text',
|
8 |
+
outputs = ['text'],
|
9 |
+
title = 'Sentiment Analysis',
|
10 |
+
examples = ['The movie was very bad', 'Every day is a new opportunity.'],
|
11 |
+
article = 'This project is for software engineering with team members Aditya Jadhav, Sujal Kuthe, Sujal Wakalkar, and Adesh Ingle. We developed a web application for sentiment analysis that takes text data as input and classifies whether it is positive or negative.',
|
12 |
+
thumbnail = '/content/sentiment-analysis.png',
|
13 |
+
theme = gr.themes.Soft())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
iface.launch()
|