File size: 883 Bytes
9053712
c0b732e
9053712
6241ddd
 
9053712
 
b4a770c
9053712
 
c0b732e
 
 
 
 
49f204b
 
 
 
c0b732e
49f204b
 
 
 
ef601a4
9053712
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
from transformers import pipeline

st.set_page_config(page_title="My Streamlit Webpage", page_icon=":tada:", layout="wide")
st.subheader("Subheader text comes here :wave:")
st.title("Getting familiar with Huggingface spaces")
st.write(
        "i am passionate about finding ways to leverage ML."
    )

form = st.form(key='sentiment-form')
user_input = form.text_area('Enter your text')
submit = form.form_submit_button('Submit')

if submit:
    classifier = pipeline("sentiment-analysis")
    result = classifier(user_input)[0]
    label = result['label']
    score = result['score']

    if label == 'POSITIVE':
        st.success(f'{label} sentiment (score: {score})')
    else:
        st.error(f'{label} sentiment (score: {score})')

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

st.write("[Learn More >](https://community.rws.com)")