Spaces:
Build error
Build error
Commit
·
661ff60
1
Parent(s):
f2fdc64
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
from transformers import pipeline
|
3 |
pipe = pipeline ('sentiment-analysis')
|
4 |
text = st.text_area('enter some text!')
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import gradio as gr
|
3 |
from transformers import pipeline
|
4 |
pipe = pipeline ('sentiment-analysis')
|
5 |
text = st.text_area('enter some text!')
|
6 |
+
def predict_sentiment(text):
|
7 |
+
result = pipe(text)[0]
|
8 |
+
return result['label']
|
9 |
+
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text")
|
12 |
+
iface.launch()
|