M17idd commited on
Commit
9578ba6
·
1 Parent(s): 03d2979

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +106 -71
app.py CHANGED
@@ -18,8 +18,8 @@ st.markdown("""
18
  <style>
19
  /* استایل برای هدر */
20
  .stAppHeader.st-emotion-cache-12fmjuu.e4hpqof0 {
21
- background-color: rgba(58, 83, 56, 0.9) !important; /* سبز متمایل به خاکی */
22
- color: #d4d4d4 !important; /* رنگ متن روشن */
23
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
24
  padding: 20px !important; /* فضای داخلی بیشتر */
25
  border-radius: 10px !important; /* گوشه‌های گرد */
@@ -43,8 +43,7 @@ st.markdown("""
43
  font-weight: 400 !important;
44
  direction: rtl;
45
  text-align: right;
46
- background-color: #2e3b2e;
47
- color: #ffffff;
48
  }
49
 
50
  /* طراحی برای بخش استایل اپ */
@@ -82,8 +81,8 @@ st.markdown("""
82
 
83
  /* استایل برای آیکون‌ها در منو */
84
  .menu-item img {
85
- width: 24px;
86
- height: 24px;
87
  }
88
 
89
  /* استایل برای دکمه‌ها */
@@ -107,25 +106,17 @@ st.markdown("""
107
  transform: translateY(-2px);
108
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
109
  }
 
 
 
 
 
 
 
 
 
 
110
 
111
- /* استایل برای متن هدر */
112
- .header-text {
113
- text-align: center;
114
- margin: 20px 0;
115
- background-color: rgba(26, 43, 30, 0.9);
116
- padding: 25px;
117
- border-radius: 15px;
118
- box-shadow: 0 6px 12px rgba(0,0,0,0.4);
119
- }
120
-
121
- /* استایل برای عنوان هدر */
122
- .header-text h1 {
123
- font-size: 42px;
124
- color: #b8860b;
125
- margin: 0;
126
- font-weight: 800;
127
- font-family: 'Roboto', Tahoma, sans-serif;
128
- }
129
 
130
  /* استایل برای زیرنویس */
131
  .subtitle {
@@ -196,7 +187,7 @@ if not st.session_state.authenticated:
196
  st.markdown("""
197
  <style>
198
  input {
199
- background-color: #1e1e1e;
200
  color: gold;
201
  border: 1px solid gold;
202
  border-radius: 10px;
@@ -216,7 +207,7 @@ if not st.session_state.authenticated:
216
  st.rerun()
217
  else:
218
  st.markdown("""
219
- <div style="background-color: rgba(241, 196, 15, 0.6); color: #1a2b1e; padding: 10px; border-radius: 10px; border: 2px solid #b8860b; margin-top: 20px; text-align: center; backdrop-filter: blur(5px);">
220
  نام کاربری یا رمز عبور اشتباه است.
221
  </div>
222
  """, unsafe_allow_html=True)
@@ -246,33 +237,95 @@ with st.sidebar:
246
 
247
  st.markdown("""
248
  <style>
249
- @font-face {
250
- font-family: 'IRANSans';
251
- src: url('https://cdn.jsdelivr.net/gh/rastikerdar/iransans/font/IRANSans.woff2') format('woff2'),
252
- url('https://cdn.jsdelivr.net/gh/rastikerdar/iransans/font/IRANSans.woff') format('woff');
253
- font-weight: 400;
254
- font-style: normal;
 
 
 
 
 
 
255
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  .header-text h1 {
257
- font-family: 'IRANSans', Tahoma, sans-serif !important;
258
- font-weight: 900 !important;
259
- font-size: 50px !important;
260
- color: #b8860b !important;
261
- margin: 0 !important;
 
 
 
 
262
  }
263
- .header-text .subtitle {
264
- font-family: 'IRANSans', Tahoma, sans-serif !important;
265
- font-weight: 600 !important;
266
- font-size: 24px !important;
267
- color: #d4d4d4 !important;
268
- margin-top: 10px !important;
 
 
 
 
 
 
 
269
  }
270
- </style>
271
- """, unsafe_allow_html=True)
272
 
273
- st.markdown("""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  <div class="header-text">
275
- <h1>رزم‌یار ارتش</h1>
276
  <div class="subtitle">دستیار هوشمند ارتش جمهوری اسلامی ایران</div>
277
  </div>
278
  """, unsafe_allow_html=True)
@@ -286,7 +339,7 @@ llm = ChatOpenAI(
286
  )
287
 
288
  # ---------- پردازش فایل‌ها با کش و موازی ----------
289
- folder_path = '46'
290
  normalizer = Normalizer()
291
  sentence_tokenizer = SentenceTokenizer()
292
 
@@ -327,7 +380,7 @@ st.markdown("""
327
  <style>
328
  /* استایل برای کلاس خاص st-emotion-cache-128upt6 eht7o1d3 */
329
  .st-emotion-cache-128upt6.eht7o1d3 {
330
- background-color: rgba(68, 83, 63, 0.8) !important; /* سبز تیره (44533f) */
331
  border-radius: 10px !important; /* گوشه‌های گرد */
332
  color: #d4d4d4 !important; /* رنگ متن روشن */
333
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
@@ -376,24 +429,17 @@ st.markdown("""
376
  }
377
  </style>
378
  """, unsafe_allow_html=True)
379
- st.markdown("""
380
- <style>
381
- .stBottom.st-emotion-cache-1p2n2i4.eht7o1d2 {
382
- background-color: #556B2F !important; /* زیتونی تیره */
383
- color: white !important; /* رنگ متن سفید برای تضاد بهتر */
384
- }
385
- </style>
386
- """, unsafe_allow_html=True)
387
  st.markdown("""
388
  <style>
389
  /* تغییر رنگ متن placeholder به خاکستری */
390
  textarea::placeholder {
391
- color: #808080 !important; /* خاکستری */
392
  opacity: 1 !important; /* برای اینکه مرورگرها بهش بی‌توجه نباشن */
393
  }
394
  /* تغییر رنگ متن داخل چت اینپوت به خاکستری */
395
  textarea {
396
- color: #808080 !important; /* خاکستری */
397
  border-radius: 10px !important;
398
  padding: 10px !important;
399
  }
@@ -422,7 +468,7 @@ st.markdown("""
422
  display: flex;
423
  align-items: center;
424
  font-size: 18px;
425
- color: #333;
426
  }
427
 
428
  .thinking-message p {
@@ -447,17 +493,6 @@ st.markdown("""
447
 
448
 
449
 
450
- # sentEmbedding = SentEmbedding()
451
- # sentEmbedding.load_model("C:/Users/ici/Downloads/sent2vec/sent2vec-naab.model")
452
-
453
-
454
-
455
- #top_k = 5
456
- #threshold = 0.8
457
-
458
- # original_sentences = all_sentences.copy()
459
- # all_vectors = [sentEmbedding.get_sentence_vector(sentence) for sentence in original_sentences]
460
-
461
  if query:
462
  found = False
463
  threshold = 62
 
18
  <style>
19
  /* استایل برای هدر */
20
  .stAppHeader.st-emotion-cache-12fmjuu.e4hpqof0 {
21
+ background-color: rgba(46,59,46, 0.8) !important; /* سبز متمایل به خاکی */
22
+ color: #2e3b2e !important; /* رنگ متن روشن */
23
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
24
  padding: 20px !important; /* فضای داخلی بیشتر */
25
  border-radius: 10px !important; /* گوشه‌های گرد */
 
43
  font-weight: 400 !important;
44
  direction: rtl;
45
  text-align: right;
46
+ ظ color: #ffffff;
 
47
  }
48
 
49
  /* طراحی برای بخش استایل اپ */
 
81
 
82
  /* استایل برای آیکون‌ها در منو */
83
  .menu-item img {
84
+ width: 25px;
85
+ height: 25px;
86
  }
87
 
88
  /* استایل برای دکمه‌ها */
 
106
  transform: translateY(-2px);
107
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
108
  }
109
+ /* استایل برای متن هدر */
110
+ .header-text {
111
+ text-align: center;
112
+ margin: 20px 0;
113
+ background-color: rgba(26, 43, 30, 0.9);
114
+ padding: 25px;
115
+ border-radius: 15px;
116
+ box-shadow: 0 6px 12px rgba(0,0,0,0.4);
117
+ font-family: 'Roboto', Tahoma, sans-serif; /* اضافه شد */
118
+ }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  /* استایل برای زیرنویس */
122
  .subtitle {
 
187
  st.markdown("""
188
  <style>
189
  input {
190
+ background-color: #2e3b2e;
191
  color: gold;
192
  border: 1px solid gold;
193
  border-radius: 10px;
 
207
  st.rerun()
208
  else:
209
  st.markdown("""
210
+ <div style="background-color: rgba(241, 196, 15, 0.6); color: #2e3b2e; padding: 10px; border-radius: 10px; border: 2px solid #2e3b2e; margin-top: 20px; text-align: center; backdrop-filter: blur(5px);">
211
  نام کاربری یا رمز عبور اشتباه است.
212
  </div>
213
  """, unsafe_allow_html=True)
 
237
 
238
  st.markdown("""
239
  <style>
240
+ /* استایل برای متن هدر */
241
+ .header-text {
242
+ text-align: center;
243
+ margin: 50px 0;
244
+ background: #2e3b2e; /* سبز زیتونی تیره جدید */
245
+ padding: 60px 30px;
246
+ border-radius: 25px;
247
+ box-shadow: 0 12px 24px rgba(0, 0, 0, 0.8); /* سایه بیشتر */
248
+ animation: slideIn 2s ease-in-out, fadeIn 3s ease-in-out;
249
+ background-size: cover;
250
+ background-position: center;
251
+ position: relative;
252
  }
253
+
254
+ /* انیمیشن ورودی */
255
+ @keyframes fadeIn {
256
+ 0% { opacity: 0; transform: translateY(30px); }
257
+ 100% { opacity: 1; transform: translateY(0); }
258
+ }
259
+
260
+ @keyframes slideIn {
261
+ 0% { transform: translateX(-50%); opacity: 0; }
262
+ 100% { transform: translateX(0); opacity: 1; }
263
+ }
264
+
265
+ /* تغییر فونت برای h1 */
266
  .header-text h1 {
267
+ font-family: 'Vazir', sans-serif;
268
+ font-size: 62px;
269
+ color: #d89b00; /* طلایی تیره‌تر */
270
+ margin: 0;
271
+ font-weight: 900;
272
+ letter-spacing: 4px;
273
+ text-shadow: 4px 4px 15px rgba(0, 0, 0, 0.9); /* سایه سیاه بیشتر */
274
+ transform: scale(1.08); /* کمی بزرگتر شدن */
275
+ animation: glow 2s ease-in-out infinite alternate;
276
  }
277
+
278
+
279
+
280
+ /* تغییر استایل زیرعنوان */
281
+ .subtitle {
282
+ font-family: 'Vazir', sans-serif;
283
+ font-size: 24px;
284
+ color: #f8f8f8;
285
+ font-weight: 700;
286
+ margin-top: 15px;
287
+ letter-spacing: 2px;
288
+ text-shadow: 3px 3px 10px rgba(0,0,0,0.8); /* سایه بیشتر برای زیرعنوان */
289
+ animation: fadeInSubtitle 2s ease-in-out;
290
  }
 
 
291
 
292
+ /* انیمیشن زیرعنوان */
293
+ @keyframes fadeInSubtitle {
294
+ 0% { opacity: 0; transform: translateY(20px); }
295
+ 100% { opacity: 1; transform: translateY(0); }
296
+ }
297
+
298
+ /* استایل برای دکمه‌ها */
299
+ .stButton>button {
300
+ background-color: #e67e22 !important; /* رنگ دکمه تغییر کرده */
301
+ color: #4b5320 !important;
302
+ font-family: 'Vazir', sans-serif;
303
+ font-weight: 700 !important;
304
+ border-radius: 20px;
305
+ padding: 15px 30px;
306
+ border: none;
307
+ transition: all 0.3s ease;
308
+ font-size: 18px;
309
+ width: 100%;
310
+ margin: 20px 0;
311
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
312
+ }
313
+
314
+ .stButton>button:hover {
315
+ background-color: #f39c12 !important;
316
+ transform: translateY(-4px);
317
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
318
+ }
319
+
320
+ /* استایل برای استایل کلی صفحه */
321
+ .stApp {
322
+ background: #2e3b2e; /* سبز زیتونی تیره جدید */
323
+ color: white;
324
+ font-family: 'Vazir', sans-serif;
325
+ }
326
+ </style>
327
  <div class="header-text">
328
+ <h1>رزم‌ یار ارتش</h1>
329
  <div class="subtitle">دستیار هوشمند ارتش جمهوری اسلامی ایران</div>
330
  </div>
331
  """, unsafe_allow_html=True)
 
339
  )
340
 
341
  # ---------- پردازش فایل‌ها با کش و موازی ----------
342
+ folder_path = 'C:/Users/ici/Downloads/Telegram Desktop/45/46'
343
  normalizer = Normalizer()
344
  sentence_tokenizer = SentenceTokenizer()
345
 
 
380
  <style>
381
  /* استایل برای کلاس خاص st-emotion-cache-128upt6 eht7o1d3 */
382
  .st-emotion-cache-128upt6.eht7o1d3 {
383
+ background-color: rgba(46,59,46, 0.8) !important; /* سبز تیره (44533f) */
384
  border-radius: 10px !important; /* گوشه‌های گرد */
385
  color: #d4d4d4 !important; /* رنگ متن روشن */
386
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
 
429
  }
430
  </style>
431
  """, unsafe_allow_html=True)
432
+
 
 
 
 
 
 
 
433
  st.markdown("""
434
  <style>
435
  /* تغییر رنگ متن placeholder به خاکستری */
436
  textarea::placeholder {
437
+ color: #ffffff !important; /* خاکستری */
438
  opacity: 1 !important; /* برای اینکه مرورگرها بهش بی‌توجه نباشن */
439
  }
440
  /* تغییر رنگ متن داخل چت اینپوت به خاکستری */
441
  textarea {
442
+ color: #ffffff !important; /* خاکستری */
443
  border-radius: 10px !important;
444
  padding: 10px !important;
445
  }
 
468
  display: flex;
469
  align-items: center;
470
  font-size: 18px;
471
+ color: #ffffff;
472
  }
473
 
474
  .thinking-message p {
 
493
 
494
 
495
 
 
 
 
 
 
 
 
 
 
 
 
496
  if query:
497
  found = False
498
  threshold = 62