M17idd commited on
Commit
6a58328
·
verified ·
1 Parent(s): b47c6c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -45
app.py CHANGED
@@ -15,107 +15,114 @@ import streamlit as st
15
 
16
  st.set_page_config(page_title="رزم یار ارتش", page_icon="🪖", layout="wide")
17
 
 
18
  st.markdown("""
19
  <style>
20
- /* فونت و راست‌چین */
21
  @import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');
 
22
  html, body, [class*="css"] {
23
  font-family: 'Vazirmatn', Tahoma, sans-serif;
24
  direction: rtl;
25
  text-align: right;
26
- background-color: #f0f4f7;
27
  }
28
 
29
- /* پس زمینه صفحه اصلی */
30
  .stApp {
31
- background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
32
- url("./military_bg.jpeg") no-repeat center center fixed;
33
- background-size: cover;
34
- backdrop-filter: blur(2px);
35
  }
36
 
37
  /* استایل پیام‌های چت */
38
  .stChatMessage {
39
- background-color: rgba(255, 255, 255, 0.85);
40
- border: 2px solid #4e8a3e;
41
- border-radius: 16px;
42
- padding: 18px;
43
- margin-bottom: 18px;
44
- box-shadow: 0 4px 12px rgba(0,0,0,0.3);
45
- animation: fadeIn 0.5s ease-in-out;
46
  }
47
 
48
- /* استایل ورودی کاربر */
49
  .stTextInput > div > input, .stTextArea textarea {
50
- background-color: rgba(255, 255, 255, 0.95) !important;
51
- border: 1px solid #ccc !important;
52
- border-radius: 10px !important;
53
- padding: 10px;
54
  direction: rtl;
55
  text-align: right;
56
  font-family: 'Vazirmatn', Tahoma;
57
- font-size: 16px;
58
  }
59
 
60
- /* استایل دکمه */
61
  .stButton>button {
62
- background-color: #4e8a3e !important;
63
  color: white !important;
64
  font-weight: bold;
65
  border-radius: 12px;
66
  padding: 10px 24px;
67
  transition: all 0.3s ease;
68
- font-size: 16px;
69
  }
70
  .stButton>button:hover {
71
- background-color: #3c6d30 !important;
72
- transform: scale(1.05);
73
  }
74
 
75
- /* سربرگ اصلی */
76
  .header-text {
77
  text-align: center;
78
- margin-top: 30px;
79
- margin-bottom: 40px;
80
- background-color: rgba(255, 255, 255, 0.8);
81
- padding: 30px;
82
- border-radius: 24px;
83
- box-shadow: 0 6px 16px rgba(0,0,0,0.25);
84
- animation: fadeIn 0.6s ease-in-out;
85
  }
86
  .header-text h1 {
87
- font-size: 48px;
88
  color: #2c3e50;
89
- margin: 0;
90
- font-weight: 900;
91
  }
92
  .subtitle {
93
- font-size: 20px;
94
  color: #34495e;
95
- margin-top: 10px;
96
- font-weight: bold;
97
  }
98
 
99
- /* انیمیشن */
100
  @keyframes fadeIn {
101
- from { opacity: 0; transform: translateY(20px); }
102
  to { opacity: 1; transform: translateY(0); }
103
  }
 
 
 
 
 
 
 
 
 
 
104
  </style>
105
  """, unsafe_allow_html=True)
106
 
107
- # ----------------- سربرگ با لوگو -----------------
108
- col1, col2, col3 = st.columns([1, 0.5, 1])
109
  with col2:
110
- st.image("log.png", width=220)
111
 
 
112
  st.markdown("""
113
  <div class="header-text">
114
  <h1>رزم یار ارتش</h1>
115
- <div class="subtitle">دستیار هوشمند نیروهای مسلح</div>
116
  </div>
117
  """, unsafe_allow_html=True)
118
 
 
119
  # ----------------- لود PDF و ساخت ایندکس -----------------
120
  class TogetherEmbeddings(Embeddings):
121
  def __init__(self, model_name: str, api_key: str):
 
15
 
16
  st.set_page_config(page_title="رزم یار ارتش", page_icon="🪖", layout="wide")
17
 
18
+ # استایل سفارشی
19
  st.markdown("""
20
  <style>
 
21
  @import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');
22
+
23
  html, body, [class*="css"] {
24
  font-family: 'Vazirmatn', Tahoma, sans-serif;
25
  direction: rtl;
26
  text-align: right;
 
27
  }
28
 
29
+ /* بکگراند اصلی */
30
  .stApp {
31
+ background: linear-gradient(135deg, #f2f6fc, #d9e4f5);
32
+ min-height: 100vh;
33
+ padding: 0;
34
+ margin: 0;
35
  }
36
 
37
  /* استایل پیام‌های چت */
38
  .stChatMessage {
39
+ background: #ffffff;
40
+ border: 1px solid #d1d5db;
41
+ border-radius: 14px;
42
+ padding: 16px;
43
+ margin-bottom: 20px;
44
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
45
+ animation: fadeIn 0.4s ease-in-out;
46
  }
47
 
48
+ /* فیلدهای ورودی */
49
  .stTextInput > div > input, .stTextArea textarea {
50
+ background: #f9fafb !important;
51
+ border-radius: 8px !important;
 
 
52
  direction: rtl;
53
  text-align: right;
54
  font-family: 'Vazirmatn', Tahoma;
 
55
  }
56
 
57
+ /* دکمه‌ها */
58
  .stButton>button {
59
+ background: linear-gradient(90deg, #4e8a3e, #5cb85c) !important;
60
  color: white !important;
61
  font-weight: bold;
62
  border-radius: 12px;
63
  padding: 10px 24px;
64
  transition: all 0.3s ease;
65
+ border: none;
66
  }
67
  .stButton>button:hover {
68
+ background: linear-gradient(90deg, #3c6d30, #4cae4c) !important;
69
+ transform: scale(1.03);
70
  }
71
 
72
+ /* هدر صفحه */
73
  .header-text {
74
  text-align: center;
75
+ margin-top: 20px;
76
+ margin-bottom: 30px;
77
+ background: rgba(255, 255, 255, 0.85);
78
+ padding: 25px;
79
+ border-radius: 20px;
80
+ box-shadow: 0 6px 16px rgba(0,0,0,0.1);
 
81
  }
82
  .header-text h1 {
83
+ font-size: 38px;
84
  color: #2c3e50;
85
+ margin-bottom: 10px;
86
+ font-weight: bold;
87
  }
88
  .subtitle {
89
+ font-size: 18px;
90
  color: #34495e;
91
+ margin-top: 5px;
 
92
  }
93
 
94
+ /* انیمیشن fadeIn */
95
  @keyframes fadeIn {
96
+ from { opacity: 0; transform: translateY(10px); }
97
  to { opacity: 1; transform: translateY(0); }
98
  }
99
+
100
+ /* منوی کناری */
101
+ [data-testid="stSidebar"] {
102
+ background: #ffffff;
103
+ border-left: 1px solid #e6e6e6;
104
+ padding: 20px;
105
+ }
106
+ [data-testid="stSidebar"] .css-1d391kg {
107
+ gap: 10px;
108
+ }
109
  </style>
110
  """, unsafe_allow_html=True)
111
 
112
+ # لوگوی وسط
113
+ col1, col2, col3 = st.columns([1, 0.2, 1])
114
  with col2:
115
+ st.image("log.png", width=240)
116
 
117
+ # هدر اصلی
118
  st.markdown("""
119
  <div class="header-text">
120
  <h1>رزم یار ارتش</h1>
121
+ <div class="subtitle">دستیار هوشمند و همراه شما در مسیر موفقیت</div>
122
  </div>
123
  """, unsafe_allow_html=True)
124
 
125
+
126
  # ----------------- لود PDF و ساخت ایندکس -----------------
127
  class TogetherEmbeddings(Embeddings):
128
  def __init__(self, model_name: str, api_key: str):