Spaces:
Runtime error
Runtime error
File size: 715 Bytes
f52cdba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|