magazine_space / app.py
gabella's picture
changed model to gabella
2fb3202
raw
history blame contribute delete
561 Bytes
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]))