v2_space / main.py
nebiyu29's picture
Create main.py
4cb0b72 verified
raw
history blame contribute delete
701 Bytes
import srteamlit as st
from transformers import AutoModelForSequenceClassification
from transformers import TextClassificationPipeline
from transformers import AutoTokenizer
model_name="nebiyu29/finetunned_version_2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model=AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer)
#classifiy model
def classify(text):
result=classifier(text)
return result
#streamlit part
user_input = st.text_input("Enter some text to generate:")
if user_input:
classified_text = classify(user_input)
st.text("classified Text:")
st.write(classified_text)