anujkumar4 commited on
Commit
4dab67e
·
verified ·
1 Parent(s): 473ecae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -1,14 +1,12 @@
1
- from streamlit import st
2
  from transformers import pipeline
3
 
4
- # Load the classification pipeline with the specified model
5
- pipe = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis")
6
- st.title("my first AI app")
7
- user_input=st.text_area('enter text:')
8
 
9
- # Classify a new sentence
10
- if user_input:
11
- result = sentiment_pipeline(user_input)[0]
12
 
13
- # Print the result
14
- print(result)
 
 
1
+ import streamlit as st
2
  from transformers import pipeline
3
 
4
+ @st.cache_resource
5
+ def load_model():
6
+ return pipeline("sentiment-analysis")
 
7
 
8
+ classifier = load_model()
 
 
9
 
10
+ text = st.text_input("Enter text")
11
+ if text:
12
+ st.write(classifier(text))