Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,7 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from openai import OpenAI
|
| 4 |
|
| 5 |
-
|
| 6 |
-
# os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
|
| 7 |
|
| 8 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY", "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"))
|
| 9 |
|
|
@@ -23,7 +22,7 @@ def create_inspiring_line(future, value, skill):
|
|
| 23 |
response = client.responses.create(
|
| 24 |
model="gpt-4.1-mini",
|
| 25 |
input=prompt,
|
| 26 |
-
temperature=1.0,
|
| 27 |
max_output_tokens=40,
|
| 28 |
)
|
| 29 |
|
|
@@ -36,20 +35,20 @@ def create_inspiring_line(future, value, skill):
|
|
| 36 |
return f"⚠️ حدث خطأ أثناء التوليد: {e}"
|
| 37 |
|
| 38 |
# 🎨 تصميم الواجهة
|
| 39 |
-
with gr.Blocks(theme=gr.themes.Soft(primary_hue="
|
| 40 |
gr.HTML("""
|
| 41 |
-
<div style="text-align:center; margin-top:
|
| 42 |
-
<img src="https://i.imgur.com/n7yR2tE.png" alt="شعار Eng.Reem" width="
|
| 43 |
-
<h1 style="color:#
|
| 44 |
-
<p style="color:#
|
| 45 |
</div>
|
| 46 |
""")
|
| 47 |
|
| 48 |
with gr.Row():
|
| 49 |
with gr.Column(scale=1):
|
| 50 |
-
future = gr.Textbox(label="
|
| 51 |
-
value = gr.Textbox(label="
|
| 52 |
-
skill = gr.Textbox(label="
|
| 53 |
submit = gr.Button("✨ أنشئي جملتك الملهمة")
|
| 54 |
|
| 55 |
with gr.Column(scale=1):
|
|
@@ -58,10 +57,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="pink", secondary_hue="violet"))
|
|
| 58 |
submit.click(fn=create_inspiring_line, inputs=[future, value, skill], outputs=output)
|
| 59 |
|
| 60 |
gr.HTML("""
|
| 61 |
-
<div style="text-align:center; margin-top:30px; color:#
|
| 62 |
-
<p>© 2025 Eng. Reem Algethami | AI & Creativity
|
| 63 |
</div>
|
| 64 |
""")
|
| 65 |
|
| 66 |
if __name__ == "__main__":
|
| 67 |
-
demo.launch()
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from openai import OpenAI
|
| 4 |
|
| 5 |
+
|
|
|
|
| 6 |
|
| 7 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY", "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"))
|
| 8 |
|
|
|
|
| 22 |
response = client.responses.create(
|
| 23 |
model="gpt-4.1-mini",
|
| 24 |
input=prompt,
|
| 25 |
+
temperature=1.0,
|
| 26 |
max_output_tokens=40,
|
| 27 |
)
|
| 28 |
|
|
|
|
| 35 |
return f"⚠️ حدث خطأ أثناء التوليد: {e}"
|
| 36 |
|
| 37 |
# 🎨 تصميم الواجهة
|
| 38 |
+
with gr.Blocks(theme=gr.themes.Soft(primary_hue="green", secondary_hue="teal")) as demo:
|
| 39 |
gr.HTML("""
|
| 40 |
+
<div style="display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; margin-top:20px;">
|
| 41 |
+
<img src="https://i.imgur.com/n7yR2tE.png" alt="شعار Eng.Reem" width="130" style="border-radius:50%; box-shadow:0 0 15px rgba(0,0,0,0.1); margin-bottom:15px;">
|
| 42 |
+
<h1 style="color:#3b5f3b; font-family:'Tajawal', sans-serif;">💫 صناع الأثر</h1>
|
| 43 |
+
<p style="color:#4b6043; font-size:18px;">حيث تتحول الأحلام إلى ومضات من الإلهام والإبداع ✨</p>
|
| 44 |
</div>
|
| 45 |
""")
|
| 46 |
|
| 47 |
with gr.Row():
|
| 48 |
with gr.Column(scale=1):
|
| 49 |
+
future = gr.Textbox(label=" حلمك المستقبلي", placeholder="مثلاً: أن أكون مهندسة تلهم الابتكار")
|
| 50 |
+
value = gr.Textbox(label=" الأثر الذي تريدين تركه", placeholder=" مثلاً: تحويل الخيال لواقع ")
|
| 51 |
+
skill = gr.Textbox(label=" مهارتك المميزة", placeholder="مثلاً: التحليل الإبداعي وحل المشكلات")
|
| 52 |
submit = gr.Button("✨ أنشئي جملتك الملهمة")
|
| 53 |
|
| 54 |
with gr.Column(scale=1):
|
|
|
|
| 57 |
submit.click(fn=create_inspiring_line, inputs=[future, value, skill], outputs=output)
|
| 58 |
|
| 59 |
gr.HTML("""
|
| 60 |
+
<div style="text-align:center; margin-top:30px; color:#768a6c;">
|
| 61 |
+
<p>© 2025 Eng. Reem Algethami | AI & Creativity 🌿</p>
|
| 62 |
</div>
|
| 63 |
""")
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
| 66 |
+
demo.launch()
|