Spaces:
Runtime error
Runtime error
Download app.py from aml987/Arabic-grammar-api: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/spaces/aml987/Arabic-grammar-api/resolve/main/app.py
- Command line
-
hf download hf://spaces/aml987/Arabic-grammar-api/app.py
-
curl -L -o app.py https://huggingface.co/spaces/aml987/Arabic-grammar-api/resolve/main/app.py
715 Bytes
| 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() | |