Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# تحميل نموذج التصنيف من مكتبة Hugging Face | |
classifier = pipeline('sentiment-analysis') | |
# تعريف دالة تقوم بتصنيف النصوص | |
def classify_text(text): | |
result = classifier(text) | |
return result[0]['label'] | |
# بناء واجهة Gradio | |
interface = gr.Interface(fn=classify_text, inputs="text", outputs="text", title="Text Classification") | |
# تشغيل التطبيق | |
if __name__ == "__main__": | |
interface.launch() | |