Spaces:
Runtime error
Runtime error
Create app.py
Browse filesSentiment Analysis Application
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
result = get_sentiment('The movie was very bad')
|
7 |
+
result
|
8 |
+
|
9 |
+
iface = gr.Interface(fn = get_sentiment,inputs="text",
|
10 |
+
outputs=['text'],
|
11 |
+
title='Sentiment Analysis',
|
12 |
+
description='Get Sentiment Analysis')
|
13 |
+
iface.launch(inline = False) #Launch app separate from one in Google Col
|