Spaces:
Runtime error
Runtime error
Jeffrey Rathgeber Jr
commited on
pipelinetest
Browse files
app.py
CHANGED
@@ -1,8 +1,16 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
|
|
3 |
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
7 |
|
8 |
st.write('You selected:', option)
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
# import numpy as np
|
4 |
|
5 |
+
classifier = pipeline(task="sentiment-analysis")
|
6 |
|
7 |
+
textIn = st.text_input("Input Text Here:", "I really like the color of your car!")
|
8 |
+
|
9 |
+
option = st.selectbox('Which pre-trained model would you like for your sentiment analysis?',('TensorFlow', 'PyTorch', 'JAX'))
|
10 |
|
11 |
st.write('You selected:', option)
|
12 |
+
|
13 |
+
# pipeline
|
14 |
+
preds = classifier(textIn)
|
15 |
+
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
|
16 |
+
st.write('Input text is ', preds[0]['label'], ' with a confidence of ', preds[0]['score'])
|