Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
# تحميل نموذج معالجة اللغة العربية | |
qa_pipeline = pipeline("question-answering", model="aubmindlab/bert-base-arabertv02") | |
# دالة لمعالجة السؤال والإجابة | |
def answer_question(question, context): | |
result = qa_pipeline(question=question, context=context) | |
return result["answer"] | |
# إنشاء واجهة API باستخدام Gradio | |
iface = gr.Interface( | |
fn=answer_question, | |
inputs=["text", "text"], | |
outputs="text", | |
title="Arabic Grammar API", | |
description="API للإجابة على أسئلة الإعراب باللغة العربية", | |
) | |
# تشغيل الواجهة | |
iface.launch() | |