rmaitest commited on
Commit
8da07e0
·
verified ·
1 Parent(s): b0a18cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,9 +1,15 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- pipe = pipeline("sentiment-analysis")
5
- text = st.text_area("enter some text:")
 
 
 
6
 
7
  if text:
8
- out = pipe(text)
9
- st.json(out)
 
 
 
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Load the text classification pipeline
5
+ classifier = pipeline("text-classification")
6
+
7
+ # Create a text input field
8
+ text = st.text_input("Enter a sentence:")
9
 
10
  if text:
11
+ # Process the text using the pipeline
12
+ output = classifier(text)
13
+
14
+ # Display the output as JSON
15
+ st.json(output)