Update app.py
Browse files
app.py
CHANGED
@@ -510,7 +510,42 @@ def clean_text(text):
|
|
510 |
return re.sub(r'[^آ-یa-zA-Z0-9۰-۹,.،؟!؛\s]+', '', text)
|
511 |
|
512 |
|
513 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
514 |
|
515 |
if "chat_history" not in st.session_state:
|
516 |
st.session_state.chat_history = []
|
@@ -537,7 +572,7 @@ if query:
|
|
537 |
{query}
|
538 |
|
539 |
خطوط مرتبط:
|
540 |
-
{
|
541 |
|
542 |
پاسخ نهایی:
|
543 |
"""
|
|
|
510 |
return re.sub(r'[^آ-یa-zA-Z0-9۰-۹,.،؟!؛\s]+', '', text)
|
511 |
|
512 |
|
513 |
+
st.markdown("""
|
514 |
+
<style>
|
515 |
+
.custom-input-container {
|
516 |
+
display: flex;
|
517 |
+
justify-content: center;
|
518 |
+
margin-bottom: 20px;
|
519 |
+
}
|
520 |
+
.custom-input input {
|
521 |
+
font-family: 'B Nazanin', sans-serif;
|
522 |
+
font-weight: bold;
|
523 |
+
color: white;
|
524 |
+
background-color: #262730;
|
525 |
+
border: 1px solid #444;
|
526 |
+
border-radius: 10px;
|
527 |
+
padding: 10px 20px;
|
528 |
+
width: 60%;
|
529 |
+
text-align: center;
|
530 |
+
font-size: 18px;
|
531 |
+
}
|
532 |
+
</style>
|
533 |
+
<div class="custom-input-container">
|
534 |
+
<div class="custom-input">
|
535 |
+
<input type="text" id="customQuery" placeholder="سؤال خود را وارد کنید:">
|
536 |
+
</div>
|
537 |
+
</div>
|
538 |
+
<script>
|
539 |
+
const inputElement = window.parent.document.querySelector("#customQuery");
|
540 |
+
if (inputElement) {
|
541 |
+
inputElement.addEventListener("change", function() {
|
542 |
+
window.parent.postMessage({type: "streamlit:setComponentValue", value: this.value}, "*");
|
543 |
+
});
|
544 |
+
}
|
545 |
+
</script>
|
546 |
+
""", unsafe_allow_html=True)
|
547 |
+
|
548 |
+
query = st.text_input(" ", key="custom_query") # برای گرفتن مقدار واقعی ورودی
|
549 |
|
550 |
if "chat_history" not in st.session_state:
|
551 |
st.session_state.chat_history = []
|
|
|
572 |
{query}
|
573 |
|
574 |
خطوط مرتبط:
|
575 |
+
{top_chunks}
|
576 |
|
577 |
پاسخ نهایی:
|
578 |
"""
|