Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
sentiment_pipeline = pipeline("sentiment-analysis")
|
| 5 |
+
def get_sentiment(input_text):
|
| 6 |
+
result = sentiment_pipeline(input_text)
|
| 7 |
+
return result[0]['label']
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn = get_sentiment,
|
| 12 |
+
inputs = 'text', outputs = 'text',
|
| 13 |
+
title = 'My first AI App',
|
| 14 |
+
description = 'Enter some text and I'll tell you whether it is positive or negative"
|
| 15 |
+
)
|
| 16 |
+
iface.launch()
|