awacke1 commited on
Commit
f7c8082
·
1 Parent(s): 6984e09

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ model = pipeline('text-classification', model='distilbert-base-uncased')
4
+ def app():
5
+ # Set the title of the app
6
+ st.title("Text Classification with Huggingface")
7
+
8
+ # Get user input
9
+ user_input = st.text_input("Enter some text")
10
+
11
+ # Classify the text using the Huggingface model
12
+ if user_input:
13
+ result = model(user_input)[0]
14
+ label = result['label']
15
+ score = result['score']
16
+
17
+ # Display the result
18
+ st.write(f"Label: {label}")
19
+ st.write(f"Score: {score}")
20
+
21
+ if __name__ == "__main__":
22
+ app()