Spaces:
Runtime error

D12004 commited on
Commit
651cca9
·
verified ·
1 Parent(s): dd5775d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -158
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  import pandas as pd
3
 
4
  # =====================================================
5
- # 1. إعداد الصفحة والتصميم المتقدم (CSS المحسن بالكامل لجينالي)
6
  # =====================================================
7
  st.set_page_config(
8
  page_title="Big Data Hero 🤖",
@@ -22,59 +22,68 @@ html, body, [class*="css"] {
22
  background: linear-gradient(to bottom, #050816, #0d1117);
23
  }
24
 
25
- /* العنوان الرئيسي للمنصة */
26
  .main-title {
27
  text-align: center;
28
  color: #00f2ff;
29
- font-size: 42px;
30
  font-weight: bold;
31
  text-shadow: 0 0 20px #00f2ff;
32
- margin-bottom: 20px;
33
  }
34
 
35
- /* رسالة الترحيب الثابتة التفاعلية */
36
  .welcome-box {
37
  background: #111827;
38
- padding: 20px;
39
  border-radius: 20px;
40
- border-right: 6px solid #00f2ff;
41
  box-shadow: 0 0 20px rgba(0,242,255,0.2);
42
  color: white;
43
- font-size: 20px;
 
44
  text-align: center;
45
- margin-bottom: 25px;
46
  }
47
 
48
- /* تصميم فقاعات محادثة الشات بوت */
49
  .chat-bubble {
50
- padding: 15px 20px;
51
  border-radius: 15px;
52
- margin: 10px 0;
53
- max-width: 85%;
54
- line-height: 1.8;
55
- font-size: 17px;
 
56
  direction: rtl;
57
  }
58
 
59
  .chat-bot {
60
  background-color: #161b22;
61
  color: white;
62
- border-right: 5px solid #00f2ff;
63
  margin-left: auto;
64
  }
65
 
66
  .chat-user {
67
  background-color: #1e293b;
68
  color: #00f2ff;
69
- border-left: 5px solid #ffd700;
70
  margin-right: auto;
71
  text-align: right;
72
  }
73
 
 
 
 
 
 
 
 
74
  /* حل مشكلة المستطيل الأبيض داخل جينالي وتخصيصه بشكل صارم */
75
  div[data-testid="stTextInput"] > div {
76
- background-color: #0c1020 !important; /* لون داكن متناسق لإلغاء الأبيض */
77
- border: 3px solid #00f2ff !important; /* حواف عريضة ومضيئة */
78
  border-radius: 12px !important;
79
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.6) !important;
80
  color: white !important;
@@ -82,8 +91,8 @@ div[data-testid="stTextInput"] > div {
82
 
83
  /* تخصيص لون وحجم خط النص المكتوب داخل المستطيل */
84
  div[data-testid="stTextInput"] input {
85
- color: #ffffff !important; /* لون النص أبيض ناصع */
86
- font-size: 18px !important; /* تكبير الخط ليكون واضحاً */
87
  font-weight: bold !important;
88
  direction: rtl !important;
89
  text-align: right !important;
@@ -91,16 +100,16 @@ div[data-testid="stTextInput"] input {
91
 
92
  /* تحسين وضوح النص التوجيهي (Placeholder) داخل المستطيل */
93
  div[data-testid="stTextInput"] input::placeholder {
94
- color: #a0aec0 !important; /* لون رمادي فاتح واضح جداً */
95
- font-size: 16px !important;
96
  }
97
 
98
- /* تنسيق وتكبير خط النتيجة (Score) ليكون بولد وضخم جداً ومضيء */
99
  .score-text {
100
- color: #ffd700 !important; /* أصفر ذهبي فاقع */
101
- font-size: 26px !important; /* حجم كبير جداً للرؤية */
102
- font-weight: 900 !important; /* خط عريض للغاية بولد */
103
- text-shadow: 0 0 15px rgba(255, 215, 0, 0.6); /* تأثير وهج مضيء */
104
  margin-top: 10px;
105
  margin-bottom: 20px;
106
  direction: rtl;
@@ -108,15 +117,15 @@ div[data-testid="stTextInput"] input::placeholder {
108
  display: block;
109
  }
110
 
111
- /* تخصيص أزرار القائمة الجانبية */
112
  .stButton > button {
113
  width: 100%;
114
  border-radius: 14px;
115
  background: linear-gradient(90deg, #1e293b, #0f172a);
116
  color: #00f2ff;
117
  border: 1px solid #00f2ff;
118
- height: 45px;
119
- font-size: 16px;
120
  font-weight: bold;
121
  margin-top: 8px;
122
  transition: 0.3s;
@@ -129,20 +138,27 @@ div[data-testid="stTextInput"] input::placeholder {
129
  transform: scale(1.02);
130
  }
131
 
132
- /* السايد بار */
133
  section[data-testid="stSidebar"] {
134
  background-color: #111827;
135
  }
136
 
137
  .sidebar-heading {
138
  color: #ffd700;
139
- font-size: 22px;
140
  font-weight: bold;
141
  margin-top: 15px;
142
  margin-bottom: 10px;
143
  border-right: 4px solid #ffd700;
144
  padding-right: 8px;
145
  }
 
 
 
 
 
 
 
146
  </style>
147
  """, unsafe_allow_html=True)
148
 
@@ -209,7 +225,7 @@ DATA = {
209
  }
210
 
211
  BOT_RESPONSES = {
212
- "مرحبا": "أهلاً بك يا بطل! كيف يمكنني مساعدتك اليوم في عالم البيانات الضخمة? 🌟",
213
  "سلام": "وعليكم السلام يا بطل البيانات! اختر موضوعاً لنكتشفه معاً 🚀",
214
  "كيف حالك": "أنا شات بوت ذكي ومتحمس جداً لمساعدتك في استكشاف كنز البيانات! 🤖✨",
215
  "ما هي البيانات الضخمة": DATA["مفهوم البيانات الضخمة"],
@@ -283,7 +299,7 @@ if st.session_state.display_content == "chat" and len(st.session_state.chat_hist
283
  </div>
284
  """, unsafe_allow_html=True)
285
 
286
- # القناة الأولى: الشات بوت
287
  if st.session_state.display_content == "chat":
288
  for msg in st.session_state.chat_history:
289
  if msg["role"] == "user":
@@ -298,126 +314,4 @@ if st.session_state.display_content == "chat":
298
 
299
  if st.button("🚀 إرسال السؤال والتحليل"):
300
  if user_query.strip() != "":
301
- reply = "سؤال رائع جداً يا بطل! لتبسيط الإجابة: البيانات الضخمة هي مستقبل التقنية وتدخل في شتى مجالاتنا الذكية اليوم. يمكنك اختيار أحد العناصر الجانبية للتعمق أكثر!"
302
- for key in BOT_RESPONSES:
303
- if key in user_query.lower():
304
- reply = BOT_RESPONSES[key]
305
- break
306
-
307
- st.session_state.chat_history.append({"role": "user", "text": user_query})
308
- st.session_state.chat_history.append({"role": "bot", "text": reply})
309
- st.rerun()
310
-
311
- # القناة الثانية: عرض محتوى الأزرار الجانبية للمواضيع
312
- elif st.session_state.display_content in DATA:
313
- st.markdown(f'<div class="chat-bubble chat-bot" style="max-width:100%; font-size: 19px;">{DATA[st.session_state.display_content]}</div>', unsafe_allow_html=True)
314
-
315
- # القناة الثالثة: اختبار التحدي
316
- elif st.session_state.display_content == "quiz":
317
- st.markdown("### 🎯 التحدي والاختبار الذكي:")
318
- if st.session_state.quiz_index < len(QUIZ_DATA):
319
- q = QUIZ_DATA[st.session_state.quiz_index]
320
- st.info(f"**{q['question']}**")
321
-
322
- user_ans = st.radio("اختر إجابتك الصحيحة من الأسفل 👇:", q["options"], key=f"quiz_radio_{st.session_state.quiz_index}")
323
-
324
- if st.button("🚀 تأكيد الإجابة والتحقق"):
325
- if user_ans == q["answer"]:
326
- st.session_state.score += 1
327
- st.success("🎉 إجابة صحيحة وممتازة يا بطل الكنز! أحسنت 🔥")
328
- else:
329
- st.error("🦾 حاول بتركيز أكبر في السؤال القادم!")
330
- st.session_state.quiz_index += 1
331
- st.rerun()
332
- else:
333
- if st.session_state.score == len(QUIZ_DATA):
334
- st.balloons()
335
- st.markdown(f'<div class="score-text" style="color: #00f2ff !important; text-align: center; font-size: 30px !important;">🏆 خارق ومذهل يا بطل الأبطال! حصلت على الدرجة النهائية الكاملة: {st.session_state.score} من {len(QUIZ_DATA)} 🔥🎈</div>', unsafe_allow_html=True)
336
- else:
337
- st.markdown(f'<div class="score-text" style="text-align: center;">🏆 مبروك يا بطل! أنهيت الاختبار ��نتيجة: {st.session_state.score} من {len(QUIZ_DATA)}</div>', unsafe_allow_html=True)
338
-
339
- if st.button("🔄 إعادة خوض التحدي من جديد"):
340
- st.session_state.quiz_index = 0
341
- st.session_state.score = 0
342
- st.rerun()
343
-
344
- # القناة الرابعة: لوحة الإحصائيات (تم إصلاح الأقواس بدقة هنا)
345
- elif st.session_state.display_content == "stats":
346
- st.markdown("### 📊 لوحة الإحصائيات والنسب العالمية")
347
- st.write("نسبة اعتماد القطاعات الحيوية المختلفة على تقنيات البيانات الضخمة:")
348
-
349
- chart_data = pd.DataFrame(
350
- [95, 88, 92, 90],
351
- index=["الطب 🏥", "التعليم 🎓", "البنوك 💳", "التجارة 🛒"],
352
- columns=["نسبة الاعتماد %"]
353
- )
354
- st.bar_chart(chart_data)
355
-
356
- # =====================================================
357
- # 6. عناصر وتصميم القائمة الجانبية (Sidebar المحدث)
358
- # =====================================================
359
- with st.sidebar:
360
- st.markdown('<div class="sidebar-heading">🏆 لوحة أبطال المستقبل</div>', unsafe_allow_html=True)
361
- st.markdown(f'<div class="score-text">⭐ مجموع نقاطك الحالية: {st.session_state.score}</div>', unsafe_allow_html=True)
362
- st.markdown("---")
363
-
364
- if st.button("💬 فتح الشات التفاعلي الحر"):
365
- st.session_state.display_content = "chat"
366
- st.rerun()
367
-
368
- st.markdown('<div class="sidebar-heading">📚 تصفح سريع للمواضيع</div>', unsafe_allow_html=True)
369
-
370
- if st.button("🌐 البيانات الضخمة"):
371
- st.session_state.display_content = "مفهوم البيانات الضخمة"
372
- st.rerun()
373
-
374
- if st.button("🎮 فائدة اللعب على جينالي"):
375
- st.session_state.display_content = "فائدة اللعب على جينالي"
376
- st.rerun()
377
-
378
- if st.button("📊 الفرق بين البيانات"):
379
- st.session_state.display_content = "الفرق"
380
- st.rerun()
381
-
382
- if st.button("🔌 مصادر البيانات"):
383
- st.session_state.display_content = "المصادر"
384
- st.rerun()
385
-
386
- if st.button("⚡ خصائص الـ 5Vs"):
387
- st.session_state.display_content = "الخصائص"
388
- st.rerun()
389
-
390
- if st.button("🏥 قطاع الطب والأشعة"):
391
- st.session_state.display_content = "الطب"
392
- st.rerun()
393
-
394
- if st.button("💳 قطاع البنوك والمصارف"):
395
- st.session_state.display_content = "البنوك"
396
- st.rerun()
397
-
398
- if st.button("🎓 قطاع التعليم والمناهج"):
399
- st.session_state.display_content = "التعليم"
400
- st.rerun()
401
-
402
- if st.button("🛒 قطاع التجارة الذكية"):
403
- st.session_state.display_content = "التجارة"
404
- st.rerun()
405
-
406
- st.markdown("---")
407
-
408
- st.markdown('<div class="sidebar-heading">🎯 الأنشطة والتحديات</div>', unsafe_allow_html=True)
409
-
410
- if st.button("🎯 خوض التحدي والاختبار"):
411
- st.session_state.display_content = "quiz"
412
- st.rerun()
413
-
414
- if st.button("📊 عرض لوحة الإحصاءات"):
415
- st.session_state.display_content = "stats"
416
- st.rerun()
417
-
418
- st.markdown("---")
419
-
420
- if st.button("🔄 إعادة تشغيل المنصة بالكامل"):
421
- for key in list(st.session_state.keys()):
422
- del st.session_state[key]
423
- st.rerun()
 
2
  import pandas as pd
3
 
4
  # =====================================================
5
+ # 1. إعداد الصفحة والتصميم المتقدم (تكبير الخطوط بالكامل لجينالي)
6
  # =====================================================
7
  st.set_page_config(
8
  page_title="Big Data Hero 🤖",
 
22
  background: linear-gradient(to bottom, #050816, #0d1117);
23
  }
24
 
25
+ /* العنوان الرئيسي للمنصة - تكبير وتوضيح */
26
  .main-title {
27
  text-align: center;
28
  color: #00f2ff;
29
+ font-size: 48px;
30
  font-weight: bold;
31
  text-shadow: 0 0 20px #00f2ff;
32
+ margin-bottom: 25px;
33
  }
34
 
35
+ /* رسالة الترحيب الثابتة التفاعلية - خط أكبر */
36
  .welcome-box {
37
  background: #111827;
38
+ padding: 25px;
39
  border-radius: 20px;
40
+ border-right: 8px solid #00f2ff;
41
  box-shadow: 0 0 20px rgba(0,242,255,0.2);
42
  color: white;
43
+ font-size: 24px;
44
+ font-weight: bold;
45
  text-align: center;
46
+ margin-bottom: 30px;
47
  }
48
 
49
+ /* تصميم فقاعات محادثة الشات بوت - تكبير الخط ليكون واضحاً جداً */
50
  .chat-bubble {
51
+ padding: 18px 25px;
52
  border-radius: 15px;
53
+ margin: 12px 0;
54
+ max-width: 90%;
55
+ line-height: 1.9;
56
+ font-size: 22px; /* تكبير خط المحادثة */
57
+ font-weight: 700;
58
  direction: rtl;
59
  }
60
 
61
  .chat-bot {
62
  background-color: #161b22;
63
  color: white;
64
+ border-right: 6px solid #00f2ff;
65
  margin-left: auto;
66
  }
67
 
68
  .chat-user {
69
  background-color: #1e293b;
70
  color: #00f2ff;
71
+ border-left: 6px solid #ffd700;
72
  margin-right: auto;
73
  text-align: right;
74
  }
75
 
76
+ /* تخصيص أسئلة ونصوص الاختبار (Quiz) لتكون كبيرة وواضحة */
77
+ div[data-testid="stMarkdownContainer"] p, p, li {
78
+ font-size: 22px !important; /* تكبير النصوص العامة والمواضيع */
79
+ font-weight: bold !important;
80
+ line-height: 1.8 !important;
81
+ }
82
+
83
  /* حل مشكلة المستطيل الأبيض داخل جينالي وتخصيصه بشكل صارم */
84
  div[data-testid="stTextInput"] > div {
85
+ background-color: #0c1020 !important;
86
+ border: 3px solid #00f2ff !important;
87
  border-radius: 12px !important;
88
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.6) !important;
89
  color: white !important;
 
91
 
92
  /* تخصيص لون وحجم خط النص المكتوب داخل المستطيل */
93
  div[data-testid="stTextInput"] input {
94
+ color: #ffffff !important;
95
+ font-size: 22px !important; /* خط كبير للكتابة */
96
  font-weight: bold !important;
97
  direction: rtl !important;
98
  text-align: right !important;
 
100
 
101
  /* تحسين وضوح النص التوجيهي (Placeholder) داخل المستطيل */
102
  div[data-testid="stTextInput"] input::placeholder {
103
+ color: #a0aec0 !important;
104
+ font-size: 18px !important;
105
  }
106
 
107
+ /* تنسيق وتكبير خط النتيجة (Score) ليكون بولد وضخم جداً ومضيء في السايد بار */
108
  .score-text {
109
+ color: #ffd700 !important;
110
+ font-size: 28px !important; /* تكبير النتيجة */
111
+ font-weight: 900 !important;
112
+ text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
113
  margin-top: 10px;
114
  margin-bottom: 20px;
115
  direction: rtl;
 
117
  display: block;
118
  }
119
 
120
+ /* تخصيص أزرار القائمة الجانبية وتكبير خطها */
121
  .stButton > button {
122
  width: 100%;
123
  border-radius: 14px;
124
  background: linear-gradient(90deg, #1e293b, #0f172a);
125
  color: #00f2ff;
126
  border: 1px solid #00f2ff;
127
+ height: 50px;
128
+ font-size: 18px; /* تكبير خط الأزرار */
129
  font-weight: bold;
130
  margin-top: 8px;
131
  transition: 0.3s;
 
138
  transform: scale(1.02);
139
  }
140
 
141
+ /* السايد بار وعناوينه */
142
  section[data-testid="stSidebar"] {
143
  background-color: #111827;
144
  }
145
 
146
  .sidebar-heading {
147
  color: #ffd700;
148
+ font-size: 24px; /* تكبير عناوين السايد بار */
149
  font-weight: bold;
150
  margin-top: 15px;
151
  margin-bottom: 10px;
152
  border-right: 4px solid #ffd700;
153
  padding-right: 8px;
154
  }
155
+
156
+ /* تخصيص خطوط الراديو الخاص بالاختيارات في الكويز */
157
+ div[data-testid="stRadio"] label {
158
+ font-size: 22px !important;
159
+ font-weight: bold !important;
160
+ color: white !important;
161
+ }
162
  </style>
163
  """, unsafe_allow_html=True)
164
 
 
225
  }
226
 
227
  BOT_RESPONSES = {
228
+ "مرحبا": "أهلاً بك يا بطل! كيف يمكنني مساعدتك اليوم في عالم البيانات الضخمة؟ 🌟",
229
  "سلام": "وعليكم السلام يا بطل البيانات! اختر موضوعاً لنكتشفه معاً 🚀",
230
  "كيف حالك": "أنا شات بوت ذكي ومتحمس جداً لمساعدتك في استكشاف كنز البيانات! 🤖✨",
231
  "ما هي البيانات الضخمة": DATA["مفهوم البيانات الضخمة"],
 
299
  </div>
300
  """, unsafe_allow_html=True)
301
 
302
+ # القناة الأولى: الشات بوت (بخطوط مكبرة)
303
  if st.session_state.display_content == "chat":
304
  for msg in st.session_state.chat_history:
305
  if msg["role"] == "user":
 
314
 
315
  if st.button("🚀 إرسال السؤال والتحليل"):
316
  if user_query.strip() != "":
317
+ reply = "سؤال رائع جداً يا بطل! لتبسيط الإجابة: البيانات الض