|
import streamlit as st
|
|
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
import torch
|
|
|
|
|
|
model_path = 'microsoft/deberta-xlarge'
|
|
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
|
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
|
|
|
|
|
st.title('DeBERTa-XLarge Model ile Metin Sınıflandırma')
|
|
|
|
|
|
user_input = st.text_area("Metni Buraya Yazın:", height=200)
|
|
|
|
if st.button("Tahmin Et"):
|
|
if user_input:
|
|
|
|
inputs = tokenizer(user_input, return_tensors='pt', padding=True, truncation=True)
|
|
|
|
|
|
with torch.no_grad():
|
|
outputs = model(**inputs)
|
|
|
|
|
|
predictions = torch.argmax(outputs.logits, dim=-1)
|
|
|
|
|
|
st.success(f'Tahmin Sonucu: {predictions.item()}')
|
|
else:
|
|
st.warning("Lütfen bir metin giriniz.") |