File size: 561 Bytes
b177247
 
 
 
 
 
 
2fb3202
b177247
 
 
 
 
7fbb173
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from transformers import pipeline
import streamlit as st
import numpy as np
import pandas as pd
import os  # secrets, or environment variables, like repository secrets

# setup pipeline
txt_classifier = pipeline('text-classification', model='gabella/distilbert-magazine-classifier',use_auth_token=os.environ['hf_token'])
user_text = st.text.input('Add the text for classification into the college major')

# if the text field has something in it, let's compue tand predict!
if user_text:
  res = txt_classifier(user_text)
  st.write(pd.Dataframe(res, index[0]))