gabella commited on
Commit
b177247
·
1 Parent(s): 6a63503

add app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import streamlit as st
3
+ import numpy as np
4
+ import pandas as pd
5
+ import os # secrets, or environment variables, like repository secrets
6
+
7
+ # setup pipeline
8
+ txt_classifier = pipeline('text-classification', model='charreaubell/distilbert-magazine-classifier',use_auth_token=os.environ['hf_token'])
9
+ user_text = st.text.input('Add the text for classification into the college major')
10
+
11
+ # if the text field has something in it, let's compue tand predict!
12
+ if user_text:
13
+ res = txt_classifier(user_text)
14
+ st.write(pd.Dataframe(res, index[0])