Spaces:
Build error
Build error
Robert Neagu commited on
Commit ·
2c557cf
1
Parent(s): e465963
Added text section
Browse files
app.py
CHANGED
|
@@ -1,4 +1,22 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
x = st.slider('Select a value')
|
| 4 |
-
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
x = st.slider('Select a value')
|
| 5 |
+
st.write(x, 'squared is', x * x)
|
| 6 |
+
|
| 7 |
+
# read about the model here: Model from https://huggingface.co/chbh7051/vit-driver-drowsiness-detection
|
| 8 |
+
model_name = "chbh7051/vit-driver-drowsiness-detection"
|
| 9 |
+
|
| 10 |
+
# the pipeline can be different things like classification, sentiment, or text-generation, question-answering
|
| 11 |
+
pipe = pipeline(
|
| 12 |
+
task="text-classification",
|
| 13 |
+
model=model_name,
|
| 14 |
+
top_k=None)
|
| 15 |
+
|
| 16 |
+
# this is the text input box for the user
|
| 17 |
+
input_text = st.text_area('Tell me how your day was and I will guess how you are feeling...')
|
| 18 |
+
|
| 19 |
+
# if text means, if the variable text is not empty then run below
|
| 20 |
+
if input_text:
|
| 21 |
+
out = pipe(input_text)
|
| 22 |
+
st.json(out)
|