edit front
Browse files- app.py +64 -28
- military_bg.jpeg +0 -0
app.py
CHANGED
|
@@ -11,62 +11,98 @@ from langchain.chat_models import ChatOpenAI
|
|
| 11 |
from typing import List
|
| 12 |
from together import Together
|
| 13 |
|
|
|
|
| 14 |
st.set_page_config(page_title="چت بات ارتش", page_icon="🪖", layout="wide")
|
| 15 |
|
| 16 |
st.markdown("""
|
| 17 |
<style>
|
| 18 |
-
.
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
}
|
| 21 |
|
| 22 |
.stChatMessage {
|
| 23 |
-
background-color:
|
|
|
|
| 24 |
border-radius: 12px;
|
| 25 |
-
padding:
|
| 26 |
-
margin-bottom:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
direction: rtl;
|
| 28 |
text-align: right;
|
| 29 |
-
font-family: '
|
| 30 |
}
|
| 31 |
|
| 32 |
-
.
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
font-
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
-
.
|
| 39 |
-
|
| 40 |
-
flex-direction: column;
|
| 41 |
-
align-items: center;
|
| 42 |
-
justify-content: center;
|
| 43 |
-
margin-top: 30px;
|
| 44 |
-
margin-bottom: 40px;
|
| 45 |
}
|
| 46 |
|
| 47 |
-
.header-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
margin-bottom:
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
| 52 |
}
|
| 53 |
|
| 54 |
-
.header-
|
| 55 |
-
font-size:
|
| 56 |
color: #2c3e50;
|
| 57 |
-
font-family: 'Tahoma', sans-serif;
|
| 58 |
margin: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
| 60 |
</style>
|
| 61 |
""", unsafe_allow_html=True)
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
st.markdown("""
|
| 64 |
-
<div class="header-
|
| 65 |
-
<
|
| 66 |
-
<
|
| 67 |
</div>
|
| 68 |
""", unsafe_allow_html=True)
|
| 69 |
|
|
|
|
| 70 |
class TogetherEmbeddings(Embeddings):
|
| 71 |
def __init__(self, model_name: str, api_key: str):
|
| 72 |
self.model_name = model_name
|
|
|
|
| 11 |
from typing import List
|
| 12 |
from together import Together
|
| 13 |
|
| 14 |
+
|
| 15 |
st.set_page_config(page_title="چت بات ارتش", page_icon="🪖", layout="wide")
|
| 16 |
|
| 17 |
st.markdown("""
|
| 18 |
<style>
|
| 19 |
+
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');
|
| 20 |
+
|
| 21 |
+
html, body, [class*="css"] {
|
| 22 |
+
font-family: 'Vazirmatn', Tahoma, sans-serif;
|
| 23 |
+
direction: rtl;
|
| 24 |
+
text-align: right;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.stApp {
|
| 28 |
+
background: url("./military_bg.jpeg") no-repeat center center fixed;
|
| 29 |
+
background-size: cover;
|
| 30 |
+
backdrop-filter: blur(2px);
|
| 31 |
}
|
| 32 |
|
| 33 |
.stChatMessage {
|
| 34 |
+
background-color: rgba(255,255,255,0.8);
|
| 35 |
+
border: 1px solid #4e8a3e;
|
| 36 |
border-radius: 12px;
|
| 37 |
+
padding: 16px;
|
| 38 |
+
margin-bottom: 15px;
|
| 39 |
+
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
|
| 40 |
+
animation: fadeIn 0.4s ease-in-out;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.stTextInput > div > input, .stTextArea textarea {
|
| 44 |
+
background-color: rgba(255,255,255,0.9) !important;
|
| 45 |
+
border-radius: 8px !important;
|
| 46 |
direction: rtl;
|
| 47 |
text-align: right;
|
| 48 |
+
font-family: 'Vazirmatn', Tahoma;
|
| 49 |
}
|
| 50 |
|
| 51 |
+
.stButton>button {
|
| 52 |
+
background-color: #4e8a3e !important;
|
| 53 |
+
color: white !important;
|
| 54 |
+
font-weight: bold;
|
| 55 |
+
border-radius: 10px;
|
| 56 |
+
padding: 8px 20px;
|
| 57 |
+
transition: 0.3s;
|
| 58 |
}
|
| 59 |
|
| 60 |
+
.stButton>button:hover {
|
| 61 |
+
background-color: #3c6d30 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
+
.header-text {
|
| 65 |
+
text-align: center;
|
| 66 |
+
margin-top: 20px;
|
| 67 |
+
margin-bottom: 40px;
|
| 68 |
+
background-color: rgba(255, 255, 255, 0.75);
|
| 69 |
+
padding: 20px;
|
| 70 |
+
border-radius: 20px;
|
| 71 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
| 72 |
}
|
| 73 |
|
| 74 |
+
.header-text h1 {
|
| 75 |
+
font-size: 42px;
|
| 76 |
color: #2c3e50;
|
|
|
|
| 77 |
margin: 0;
|
| 78 |
+
font-weight: bold;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.subtitle {
|
| 82 |
+
font-size: 18px;
|
| 83 |
+
color: #34495e;
|
| 84 |
+
margin-top: 8px;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
@keyframes fadeIn {
|
| 88 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 89 |
+
to { opacity: 1; transform: translateY(0); }
|
| 90 |
}
|
| 91 |
</style>
|
| 92 |
""", unsafe_allow_html=True)
|
| 93 |
|
| 94 |
+
col1, col2, col3 = st.columns([1, 1, 1])
|
| 95 |
+
with col2:
|
| 96 |
+
st.image("army.png", width=240)
|
| 97 |
+
|
| 98 |
st.markdown("""
|
| 99 |
+
<div class="header-text">
|
| 100 |
+
<h1>چت بات ارتش</h1>
|
| 101 |
+
<div class="subtitle">دستیار هوشمند برای تصمیمگیری در میدان نبرد</div>
|
| 102 |
</div>
|
| 103 |
""", unsafe_allow_html=True)
|
| 104 |
|
| 105 |
+
|
| 106 |
class TogetherEmbeddings(Embeddings):
|
| 107 |
def __init__(self, model_name: str, api_key: str):
|
| 108 |
self.model_name = model_name
|
military_bg.jpeg
ADDED
|