MarieAngeA13 commited on
Commit
0c23360
·
1 Parent(s): 86186b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -1,3 +1,20 @@
1
- import gradio as gr
 
2
 
3
- gr.Interface.load("models/MarieAngeA13/Sentiment-Analysis-BERT").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
 
4
+ # Load the sentiment analysis model from Hugging Face
5
+ classifier = pipeline('sentiment-analysis')
6
+
7
+ # Create a Streamlit app
8
+ st.title('Sentiment Analysis with Hugging Face')
9
+ st.write('Enter some text and we will predict its sentiment!')
10
+
11
+ # Add a text input box for the user to enter text
12
+ text_input = st.text_input('Enter text here')
13
+
14
+ # When the user submits text, run the sentiment analysis model on it
15
+ if st.button('Submit'):
16
+ # Predict the sentiment of the text using the Hugging Face model
17
+ sentiment = classifier(text_input)[0]['label']
18
+
19
+ # Display the sentiment prediction to the user
20
+ st.write(f'Sentiment: {sentiment}')