File size: 659 Bytes
7df893d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

# نحمّل نموذج لغوي جاهز من Hugging Face
generator = pipeline("text-generation", model="aubmindlab/aragpt2-base")

def arabic_text_idea(prompt):
    result = generator(prompt, max_length=60, num_return_sequences=1)
    return result[0]['generated_text']

app = gr.Interface(
    fn=arabic_text_idea,
    inputs=gr.Textbox(lines=2, label="اكتب فكرة أو موضوعًا"),
    outputs="text",
    title="مولّد الجمل العربية ✨",
    description="أدخل فكرة بالعربية وسيكتب الذكاء الاصطناعي جملة عنها."
)

app.launch()