Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,16 @@ MODEL_NAME = "gemini-1.5-flash"
|
|
| 10 |
|
| 11 |
def generate_main_question_gemini(paragraph: str):
|
| 12 |
if not paragraph or paragraph.strip() == "":
|
| 13 |
-
return "
|
| 14 |
|
| 15 |
prompt = f"""
|
| 16 |
-
|
| 17 |
{paragraph}
|
| 18 |
|
| 19 |
-
|
| 20 |
-
-
|
|
|
|
|
|
|
| 21 |
"""
|
| 22 |
try:
|
| 23 |
response = client.models.generate_content(model=MODEL_NAME, contents=prompt)
|
|
@@ -27,7 +29,7 @@ Task:
|
|
| 27 |
|
| 28 |
|
| 29 |
with gr.Blocks() as demo:
|
| 30 |
-
gr.Markdown("## MainQuestion — Basic Question Generator (Arabic)")
|
| 31 |
|
| 32 |
with gr.Row():
|
| 33 |
paragraph = gr.Textbox(
|
|
@@ -36,7 +38,7 @@ with gr.Blocks() as demo:
|
|
| 36 |
placeholder="Paste the paragraph here..."
|
| 37 |
)
|
| 38 |
|
| 39 |
-
output = gr.Textbox(label="Generated Question", lines=3)
|
| 40 |
|
| 41 |
submit_btn = gr.Button("Submit")
|
| 42 |
submit_btn.click(fn=generate_main_question_gemini, inputs=paragraph, outputs=output)
|
|
|
|
| 10 |
|
| 11 |
def generate_main_question_gemini(paragraph: str):
|
| 12 |
if not paragraph or paragraph.strip() == "":
|
| 13 |
+
return "الرجاء إدخال فقرة أولاً."
|
| 14 |
|
| 15 |
prompt = f"""
|
| 16 |
+
الفقرة التالية:
|
| 17 |
{paragraph}
|
| 18 |
|
| 19 |
+
المطلوب:
|
| 20 |
+
- أنشئ سؤالًا رئيسيًا واحدًا فقط باللغة العربية الفصحى.
|
| 21 |
+
- يجب أن يكون السؤال بسيط جدًا (مستوى سهل جدًا).
|
| 22 |
+
- اكتب السؤال بالعربية فقط بدون أي ترجمة أو نص إضافي.
|
| 23 |
"""
|
| 24 |
try:
|
| 25 |
response = client.models.generate_content(model=MODEL_NAME, contents=prompt)
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
+
gr.Markdown("## MainQuestion — Basic Question Generator (Arabic Output)")
|
| 33 |
|
| 34 |
with gr.Row():
|
| 35 |
paragraph = gr.Textbox(
|
|
|
|
| 38 |
placeholder="Paste the paragraph here..."
|
| 39 |
)
|
| 40 |
|
| 41 |
+
output = gr.Textbox(label="Generated Question (Arabic)", lines=3)
|
| 42 |
|
| 43 |
submit_btn = gr.Button("Submit")
|
| 44 |
submit_btn.click(fn=generate_main_question_gemini, inputs=paragraph, outputs=output)
|