M17idd commited on
Commit
8d3ad72
·
1 Parent(s): 0ce480a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +95 -5
app.py CHANGED
@@ -6,7 +6,19 @@ from langchain.chat_models import ChatOpenAI
6
  from langchain.schema import SystemMessage, HumanMessage
7
  from rapidfuzz import fuzz
8
  import concurrent.futures
9
-
 
 
 
 
 
 
 
 
 
 
 
 
10
  st.markdown("""
11
  <style>
12
  @font-face {
@@ -186,7 +198,34 @@ with st.sidebar:
186
  if idx in [1, 3, 5]:
187
  st.markdown("<hr/>", unsafe_allow_html=True)
188
 
189
- # ---------- سربرگ ----------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  st.markdown("""
191
  <div class="header-text">
192
  <h1>رزم‌یار ارتش</h1>
@@ -202,7 +241,7 @@ llm = ChatOpenAI(
202
  )
203
 
204
  # ---------- پردازش فایل‌ها با کش و موازی ----------
205
- folder_path = '46'
206
  normalizer = Normalizer()
207
  sentence_tokenizer = SentenceTokenizer()
208
 
@@ -231,8 +270,59 @@ def load_and_process_documents(path):
231
  all_sentences = load_and_process_documents(folder_path)
232
 
233
  # ---------- ورودی جستجو ----------
234
- query = st.text_input("🔎 کلمه یا عبارت موردنظر خود را وارد کنید:")
235
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  if query:
237
  found = False
238
  threshold = 70
 
6
  from langchain.schema import SystemMessage, HumanMessage
7
  from rapidfuzz import fuzz
8
  import concurrent.futures
9
+ st.markdown("""
10
+ <style>
11
+ /* استایل برای هدر */
12
+ .stAppHeader.st-emotion-cache-12fmjuu.e4hpqof0 {
13
+ background-color: rgba(58, 83, 56, 0.9) !important; /* سبز متمایل به خاکی */
14
+ color: #d4d4d4 !important; /* رنگ متن روشن */
15
+ font-family: 'Vazirmatn', Tahoma, sans-serif !important;
16
+ padding: 20px !important; /* فضای داخلی بیشتر */
17
+ border-radius: 10px !important; /* گوشه‌های گرد */
18
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important; /* سایه برای برجسته شدن */
19
+ }
20
+ </style>
21
+ """, unsafe_allow_html=True)
22
  st.markdown("""
23
  <style>
24
  @font-face {
 
198
  if idx in [1, 3, 5]:
199
  st.markdown("<hr/>", unsafe_allow_html=True)
200
 
201
+ st.markdown("""
202
+ <style>
203
+ @font-face {
204
+ font-family: 'IRANSans';
205
+ src: url('https://cdn.jsdelivr.net/gh/rastikerdar/iransans/font/IRANSans.woff2') format('woff2'),
206
+ url('https://cdn.jsdelivr.net/gh/rastikerdar/iransans/font/IRANSans.woff') format('woff');
207
+ font-weight: 400;
208
+ font-style: normal;
209
+ }
210
+
211
+ .header-text h1 {
212
+ font-family: 'IRANSans', Tahoma, sans-serif !important;
213
+ font-weight: 900 !important;
214
+ font-size: 50px !important;
215
+ color: #b8860b !important;
216
+ margin: 0 !important;
217
+ }
218
+
219
+ .header-text .subtitle {
220
+ font-family: 'IRANSans', Tahoma, sans-serif !important;
221
+ font-weight: 600 !important;
222
+ font-size: 24px !important;
223
+ color: #d4d4d4 !important;
224
+ margin-top: 10px !important;
225
+ }
226
+ </style>
227
+ """, unsafe_allow_html=True)
228
+
229
  st.markdown("""
230
  <div class="header-text">
231
  <h1>رزم‌یار ارتش</h1>
 
241
  )
242
 
243
  # ---------- پردازش فایل‌ها با کش و موازی ----------
244
+ folder_path = 'C:/Users/ici/Downloads/Telegram Desktop/45/46'
245
  normalizer = Normalizer()
246
  sentence_tokenizer = SentenceTokenizer()
247
 
 
270
  all_sentences = load_and_process_documents(folder_path)
271
 
272
  # ---------- ورودی جستجو ----------
273
+ st.markdown("""
274
+ <style>
275
+ /* استایل برای کلاس خاص st-emotion-cache-128upt6 eht7o1d3 */
276
+ .st-emotion-cache-128upt6.eht7o1d3 {
277
+ background-color: rgba(68, 83, 63, 0.8) !important; /* سبز تیره (44533f) */
278
+ border-radius: 10px !important; /* گوشه‌های گرد */
279
+ color: #d4d4d4 !important; /* رنگ متن روشن */
280
+ font-family: 'Vazirmatn', Tahoma, sans-serif !important;
281
+ padding: 15px !important; /* فضای داخلی بیشتر */
282
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important; /* سایه برای برجسته شدن */
283
+ }
284
+ </style>
285
+ """, unsafe_allow_html=True)
286
+ st.markdown("""
287
+ <style>
288
+ /* استایل برای کلاس خاص */
289
+ .st-ae.st-bd.st-be.st-bf.st-bg.st-bh.st-bi.st-bj.st-bk.st-bl.st-bm.st-ah.st-bn.st-bo.st-bp.st-bq.st-br.st-bs.st-ci.st-cj.st-ax.st-ay.st-az.st-bv.st-b1.st-b2.st-bc.st-bw.st-bx.st-by.st-ck.st-cl.st-cn {
290
+ background-color: rgba(106, 127, 83, 0.8) !important; /* سبز خاکی مایل به زرد (#6a7f53) */
291
+ border-radius: 10px !important; /* گوشه‌های گرد */
292
+ color: #d4d4d4 !important; /* رنگ متن روشن */
293
+ font-family: 'Vazirmatn', Tahoma, sans-serif !important;
294
+ padding: 15px !important; /* فضای داخلی بیشتر */
295
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important; /* سایه برای برجسته شدن */
296
+ }
297
+ </style>
298
+ """, unsafe_allow_html=True)
299
+ st.markdown("""
300
+ <style>
301
+ /* استایل برای کلاس st-emotion-cache-yd4u6l e1togvvn1 */
302
+ .st-emotion-cache-yd4u6l.e1togvvn1 {
303
+ background-color: rgba(106, 127, 83, 0.8) !important; /* سبز خاکی مایل به زرد (#6a7f53) */
304
+ border-radius: 10px !important; /* گوشه‌های گرد */
305
+ color: #d4d4d4 !important; /* رنگ متن روشن */
306
+ font-family: 'Vazirmatn', Tahoma, sans-serif !important;
307
+ padding: 15px !important; /* فضای داخلی بیشتر */
308
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important; /* سایه برای برجسته شدن */
309
+ }
310
+ </style>
311
+ """, unsafe_allow_html=True)
312
+ st.markdown("""
313
+ <style>
314
+ /* استایل برای هدر */
315
+ .stAppHeader.st-emotion-cache-12fmjuu.e4hpqof0 {
316
+ background-color: rgba(42, 55, 39, 0.9) !important; /* سبز تیره‌تر */
317
+ color: #d4d4d4 !important; /* رنگ متن روشن */
318
+ font-family: 'Vazirmatn', Tahoma, sans-serif !important;
319
+ padding: 20px !important; /* فضای داخلی بیشتر */
320
+ border-radius: 10px !important; /* گوشه‌های گرد */
321
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important; /* سایه برای برجسته شدن */
322
+ }
323
+ </style>
324
+ """, unsafe_allow_html=True)
325
+ query = st.chat_input("چطور می‌تونم کمک کنم؟")
326
  if query:
327
  found = False
328
  threshold = 70