File size: 747 Bytes
cd47622
2c557cf
cd47622
e465963
2c557cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
from transformers import pipeline

x = st.slider('Select a value')
st.write(x, 'squared is', x * x)

# read about the model here:  Model from https://huggingface.co/chbh7051/vit-driver-drowsiness-detection
model_name = "chbh7051/vit-driver-drowsiness-detection"

# the pipeline can be different things like classification, sentiment, or text-generation, question-answering
pipe = pipeline(
    task="text-classification", 
    model=model_name, 
    top_k=None)

# this is the text input box for the user
input_text = st.text_area('Tell me how your day was and I will guess how you are feeling...')

# if text means, if the variable text is not empty then run below
if input_text:
    out = pipe(input_text)
    st.json(out)