Spaces:
Build error
Build error
| import gradio as gr | |
| from transformers import pipeline | |
| # Hugging Face'den modeli yükle | |
| pipe = pipeline("text-classification", model="gokceuludogan/convbert-base-turkish-mc4-toxicity-uncased") | |
| # Gradio arayüzü oluştur | |
| def predict_toxicity(text): | |
| result = pipe(text)[0] | |
| toxicity_label = result['label'] | |
| toxicity_score = result['score'] | |
| return f"Toksisite: {toxicity_label}, Skor: {toxicity_score}" | |
| iface = gr.Interface( | |
| fn=predict_toxicity, | |
| inputs=gr.inputs.Textbox(lines=5, label="Metin"), | |
| outputs="text", | |
| title="Türkçe Metin Toksisite Sınıflandırma", | |
| description="Bu model, Türkçe metinlerde toksisiteyi sınıflandırmak için eğitilmiştir. Lütfen bir metin girin ve sonucu görün." | |
| ) | |
| iface.launch() | |