|
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) |
|
|
|
|
|
def classify(text): |
|
result=classifier(text) |
|
return result |
|
|
|
|
|
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) |
|
|
|
|