Upload 3 files
Browse files- app.py +31 -0
- modelFile.pkl +3 -0
- requirements.txt +12 -0
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
# Model ve tokenizer'ı yükle
|
| 6 |
+
model_path = 'microsoft/deberta-xlarge'
|
| 7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 8 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 9 |
+
|
| 10 |
+
# Streamlit uygulaması
|
| 11 |
+
st.title('DeBERTa-XLarge Model ile Metin Sınıflandırma')
|
| 12 |
+
|
| 13 |
+
# Kullanıcıdan metin girişi al
|
| 14 |
+
user_input = st.text_area("Metni Buraya Yazın:", height=200)
|
| 15 |
+
|
| 16 |
+
if st.button("Tahmin Et"):
|
| 17 |
+
if user_input:
|
| 18 |
+
# Tokenizasyon
|
| 19 |
+
inputs = tokenizer(user_input, return_tensors='pt', padding=True, truncation=True)
|
| 20 |
+
|
| 21 |
+
# Modeli çalıştır
|
| 22 |
+
with torch.no_grad():
|
| 23 |
+
outputs = model(**inputs)
|
| 24 |
+
|
| 25 |
+
# Tahmini elde et
|
| 26 |
+
predictions = torch.argmax(outputs.logits, dim=-1)
|
| 27 |
+
|
| 28 |
+
# Sonucu göster
|
| 29 |
+
st.success(f'Tahmin Sonucu: {predictions.item()}')
|
| 30 |
+
else:
|
| 31 |
+
st.warning("Lütfen bir metin giriniz.")
|
modelFile.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a3fce95a4eb327c940d97a05dd62265007f26c006f40c8ec0a480f9d82072481
|
| 3 |
+
size 55310307
|
requirements.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow
|
| 3 |
+
opencv-python
|
| 4 |
+
scikit-learn
|
| 5 |
+
torch
|
| 6 |
+
torchvision
|
| 7 |
+
matplotlib
|
| 8 |
+
transformers
|
| 9 |
+
sentencepiece
|
| 10 |
+
plotly
|
| 11 |
+
xgboost
|
| 12 |
+
joblib
|