Update app.py
Browse files
app.py
CHANGED
@@ -7,12 +7,18 @@ from langchain.schema import SystemMessage, HumanMessage
|
|
7 |
from rapidfuzz import fuzz
|
8 |
import concurrent.futures
|
9 |
|
10 |
-
# ---------- استایل ----------
|
11 |
st.markdown("""
|
12 |
<style>
|
13 |
-
@
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
html, body, [class*="css"] {
|
15 |
-
font-family: '
|
|
|
16 |
direction: rtl;
|
17 |
text-align: right;
|
18 |
}
|
@@ -32,6 +38,7 @@ st.markdown("""
|
|
32 |
gap: 12px;
|
33 |
padding: 12px 20px;
|
34 |
font-size: 16px;
|
|
|
35 |
color: #d4d4d4;
|
36 |
cursor: pointer;
|
37 |
transition: background-color 0.3s ease;
|
@@ -47,8 +54,8 @@ st.markdown("""
|
|
47 |
.stButton>button {
|
48 |
background-color: #b8860b !important;
|
49 |
color: #1a2b1e !important;
|
50 |
-
font-family: '
|
51 |
-
font-weight: 700;
|
52 |
border-radius: 10px;
|
53 |
padding: 12px 24px;
|
54 |
border: none;
|
@@ -74,11 +81,12 @@ st.markdown("""
|
|
74 |
font-size: 42px;
|
75 |
color: #b8860b;
|
76 |
margin: 0;
|
77 |
-
font-weight:
|
78 |
}
|
79 |
.subtitle {
|
80 |
font-size: 18px;
|
81 |
color: #d4d4d4;
|
|
|
82 |
margin-top: 10px;
|
83 |
}
|
84 |
.chat-message {
|
@@ -91,6 +99,7 @@ st.markdown("""
|
|
91 |
animation: fadeIn 0.6s ease;
|
92 |
font-size: 18px;
|
93 |
color: #d4d4d4;
|
|
|
94 |
display: flex;
|
95 |
align-items: center;
|
96 |
gap: 15px;
|
@@ -104,7 +113,8 @@ st.markdown("""
|
|
104 |
border-radius: 10px !important;
|
105 |
border: 1px solid #b8860b !important;
|
106 |
padding: 12px !important;
|
107 |
-
font-family: '
|
|
|
108 |
font-size: 16px;
|
109 |
color: #d4d4d4 !important;
|
110 |
}
|
@@ -118,20 +128,40 @@ st.markdown("""
|
|
118 |
</style>
|
119 |
""", unsafe_allow_html=True)
|
120 |
|
|
|
121 |
# ---------- احراز هویت ----------
|
122 |
if "authenticated" not in st.session_state:
|
123 |
st.session_state.authenticated = False
|
124 |
|
125 |
if not st.session_state.authenticated:
|
126 |
-
st.markdown(
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
if st.button("ورود"):
|
130 |
if username == "admin" and password == "123":
|
131 |
st.session_state.authenticated = True
|
132 |
st.rerun()
|
133 |
else:
|
134 |
-
st.
|
|
|
|
|
|
|
|
|
135 |
st.stop()
|
136 |
|
137 |
# ---------- سایدبار ----------
|
@@ -172,7 +202,7 @@ llm = ChatOpenAI(
|
|
172 |
)
|
173 |
|
174 |
# ---------- پردازش فایلها با کش و موازی ----------
|
175 |
-
folder_path = '46'
|
176 |
normalizer = Normalizer()
|
177 |
sentence_tokenizer = SentenceTokenizer()
|
178 |
|
|
|
7 |
from rapidfuzz import fuzz
|
8 |
import concurrent.futures
|
9 |
|
|
|
10 |
st.markdown("""
|
11 |
<style>
|
12 |
+
@font-face {
|
13 |
+
font-family: 'Shabnam';
|
14 |
+
src: url('https://cdn.jsdelivr.net/gh/rastikerdar/shabnam-font/dist/Shabnam.woff2') format('woff2'),
|
15 |
+
url('https://cdn.jsdelivr.net/gh/rastikerdar/shabnam-font/dist/Shabnam.woff') format('woff');
|
16 |
+
font-weight: 400;
|
17 |
+
font-style: normal;
|
18 |
+
}
|
19 |
html, body, [class*="css"] {
|
20 |
+
font-family: 'Shabnam', Tahoma, sans-serif !important;
|
21 |
+
font-weight: 500 !important;
|
22 |
direction: rtl;
|
23 |
text-align: right;
|
24 |
}
|
|
|
38 |
gap: 12px;
|
39 |
padding: 12px 20px;
|
40 |
font-size: 16px;
|
41 |
+
font-weight: 600;
|
42 |
color: #d4d4d4;
|
43 |
cursor: pointer;
|
44 |
transition: background-color 0.3s ease;
|
|
|
54 |
.stButton>button {
|
55 |
background-color: #b8860b !important;
|
56 |
color: #1a2b1e !important;
|
57 |
+
font-family: 'Shabnam', Tahoma;
|
58 |
+
font-weight: 700 !important;
|
59 |
border-radius: 10px;
|
60 |
padding: 12px 24px;
|
61 |
border: none;
|
|
|
81 |
font-size: 42px;
|
82 |
color: #b8860b;
|
83 |
margin: 0;
|
84 |
+
font-weight: 800;
|
85 |
}
|
86 |
.subtitle {
|
87 |
font-size: 18px;
|
88 |
color: #d4d4d4;
|
89 |
+
font-weight: 600;
|
90 |
margin-top: 10px;
|
91 |
}
|
92 |
.chat-message {
|
|
|
99 |
animation: fadeIn 0.6s ease;
|
100 |
font-size: 18px;
|
101 |
color: #d4d4d4;
|
102 |
+
font-weight: 600;
|
103 |
display: flex;
|
104 |
align-items: center;
|
105 |
gap: 15px;
|
|
|
113 |
border-radius: 10px !important;
|
114 |
border: 1px solid #b8860b !important;
|
115 |
padding: 12px !important;
|
116 |
+
font-family: 'Shabnam', Tahoma;
|
117 |
+
font-weight: 500;
|
118 |
font-size: 16px;
|
119 |
color: #d4d4d4 !important;
|
120 |
}
|
|
|
128 |
</style>
|
129 |
""", unsafe_allow_html=True)
|
130 |
|
131 |
+
|
132 |
# ---------- احراز هویت ----------
|
133 |
if "authenticated" not in st.session_state:
|
134 |
st.session_state.authenticated = False
|
135 |
|
136 |
if not st.session_state.authenticated:
|
137 |
+
st.markdown('<style>.stTextInput > div[data-baseweb="input"] + div, .stTextInput div:has(div[role="alert"]) { display: none !important; }</style>', unsafe_allow_html=True)
|
138 |
+
st.markdown("""
|
139 |
+
<style>
|
140 |
+
input {
|
141 |
+
background-color: #1e1e1e;
|
142 |
+
color: gold;
|
143 |
+
border: 1px solid gold;
|
144 |
+
border-radius: 10px;
|
145 |
+
padding: 10px;
|
146 |
+
}
|
147 |
+
</style>
|
148 |
+
""", unsafe_allow_html=True)
|
149 |
+
username = st.text_input("نام کاربری:", placeholder="شناسه نظامی خود را وارد کنید",
|
150 |
+
label_visibility="visible")
|
151 |
+
|
152 |
+
password = st.text_input("رمز عبور:", placeholder="رمز عبور نظامی", type="password",
|
153 |
+
label_visibility="visible")
|
154 |
+
|
155 |
if st.button("ورود"):
|
156 |
if username == "admin" and password == "123":
|
157 |
st.session_state.authenticated = True
|
158 |
st.rerun()
|
159 |
else:
|
160 |
+
st.markdown("""
|
161 |
+
<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);">
|
162 |
+
نام کاربری یا رمز عبور اشتباه است.
|
163 |
+
</div>
|
164 |
+
""", unsafe_allow_html=True)
|
165 |
st.stop()
|
166 |
|
167 |
# ---------- سایدبار ----------
|
|
|
202 |
)
|
203 |
|
204 |
# ---------- پردازش فایلها با کش و موازی ----------
|
205 |
+
folder_path = 'C:/Users/ici/Downloads/Telegram Desktop/45/46'
|
206 |
normalizer = Normalizer()
|
207 |
sentence_tokenizer = SentenceTokenizer()
|
208 |
|