Spaces:
Sleeping
Sleeping
Arabic.qy
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# نحمّل نموذج لغوي جاهز من Hugging Face
|
| 5 |
+
generator = pipeline("text-generation", model="aubmindlab/aragpt2-base")
|
| 6 |
+
|
| 7 |
+
def arabic_text_idea(prompt):
|
| 8 |
+
result = generator(prompt, max_length=60, num_return_sequences=1)
|
| 9 |
+
return result[0]['generated_text']
|
| 10 |
+
|
| 11 |
+
app = gr.Interface(
|
| 12 |
+
fn=arabic_text_idea,
|
| 13 |
+
inputs=gr.Textbox(lines=2, label="اكتب فكرة أو موضوعًا"),
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="مولّد الجمل العربية ✨",
|
| 16 |
+
description="أدخل فكرة بالعربية وسيكتب الذكاء الاصطناعي جملة عنها."
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
app.launch()
|