Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
|
|
|
| 3 |
sentiment_pipeline = pipeline("sentiment-analysis")
|
| 4 |
-
def get_sentiment(input_text):
|
| 5 |
-
result = sentiment_pipeline(input_text)
|
| 6 |
-
return result[0]['label']
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
#
|
| 10 |
iface = gr.Interface(
|
| 11 |
-
fn
|
| 12 |
-
inputs
|
| 13 |
-
output
|
| 14 |
-
|
| 15 |
-
description
|
| 16 |
-
|
| 17 |
)
|
| 18 |
-
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
+
|
| 4 |
sentiment_pipeline = pipeline("sentiment-analysis")
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
def get_sentiment(input_text):
|
| 7 |
+
result = sentiment_pipeline(input_text)
|
| 8 |
+
return result[0]['label']
|
| 9 |
|
| 10 |
+
# Launch web UI
|
| 11 |
iface = gr.Interface(
|
| 12 |
+
fn=get_sentiment,
|
| 13 |
+
inputs='text',
|
| 14 |
+
outputs='text', # 'output' should be 'outputs'
|
| 15 |
+
title='my first AI app',
|
| 16 |
+
description=""
|
|
|
|
| 17 |
)
|
| 18 |
+
|
| 19 |
+
iface.launch()
|