Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# read about the model here: https://huggingface.co/SamLowe/roberta-base-go_emotions
|
| 5 |
+
model_name = "SamLowe/roberta-base-go_emotions"
|
| 6 |
+
|
| 7 |
+
# the pipeline can be different things like classification, sentiment, or text-generation, question-answering
|
| 8 |
+
pipe = pipeline(
|
| 9 |
+
task="text-classification",
|
| 10 |
+
model=model_name,
|
| 11 |
+
top_k=None)
|
| 12 |
+
|
| 13 |
+
# this is the text input box for the user
|
| 14 |
+
input_text = st.text_area('Tell me how your day was and I will guess how you are feeling...')
|
| 15 |
+
|
| 16 |
+
# if text means, if the variable text is not empty then run below
|
| 17 |
+
if input_text:
|
| 18 |
+
out = pipe(input_text)
|
| 19 |
+
st.json(out)
|