sentiment-Analysis / frontend /streamlitApp.py
Anki2004's picture
Upload 16 files
a01a0b1 verified
Raw
History Blame Contribute Delete
520 Bytes
import streamlit as st
import requests
st.title("Sentiment Analysis")
text = st.text_area("Enter the text for analysis", height = 100)
if st.button('Analyze Sentiment'):
if text:
response = requests.post('http://localhost:5000/predict', json={'text':text})
print(response.text)
result = response.json()
st.write(f"sentiment: {result['sentiment']}")
st.write(f"confidence: {result['confidence']: .2f}")
else:
st.write("Please enter some text")