FatimaWaeli commited on
Commit
ff7dbff
·
1 Parent(s): 67bf90c

Add application file

Browse files
Files changed (1) hide show
  1. app.py +205 -32
app.py CHANGED
@@ -10,32 +10,52 @@ import time
10
 
11
  # Custom CSS for better styling
12
  custom_css = """
 
 
13
  .gradio-container {
14
- background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
15
- font-family: 'Vazirmatn', 'Tahoma', sans-serif;
 
16
  }
17
 
18
  .main-header {
19
- color: #2d3748;
20
  text-align: center;
21
- margin-bottom: 2rem;
22
- text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
  .container {
26
- max-width: 900px;
27
- margin: 0 auto;
28
- padding: 20px;
29
- background-color: white;
30
- border-radius: 12px;
31
- box-shadow: 0 10px 25px rgba(0,0,0,0.1);
 
 
32
  }
33
 
34
  .footer {
35
  text-align: center;
36
- margin-top: 2rem;
37
- color: #4a5568;
38
- font-size: 0.9rem;
 
 
39
  }
40
 
41
  /* Persian text alignment */
@@ -44,42 +64,195 @@ textarea, .label {
44
  direction: rtl;
45
  }
46
 
 
 
 
 
 
 
 
 
47
  /* Button styling */
48
  button.primary {
49
- background: linear-gradient(to right, #4776E6, #8E54E9);
50
- border: none;
51
- border-radius: 8px;
52
- color: white;
53
- font-weight: bold;
54
- transition: all 0.3s ease;
 
 
 
55
  }
56
 
57
  button.primary:hover {
58
- transform: translateY(-2px);
59
- box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
 
 
 
 
 
60
  }
61
 
 
62
  .input-panel, .output-panel {
63
  background-color: rgba(255, 255, 255, 0.9);
64
- border-radius: 10px;
65
- padding: 15px;
66
- margin-bottom: 15px;
67
  border: 1px solid #e2e8f0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
 
70
  .examples-panel {
71
- background-color: rgba(255, 255, 255, 0.8);
72
- border-radius: 10px;
73
- padding: 10px;
74
  border: 1px solid #e2e8f0;
 
75
  }
76
 
77
  .status-panel {
78
- background-color: #edf2f7;
79
- border-radius: 8px;
80
- padding: 10px;
81
- margin-bottom: 15px;
82
  text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
  """
85
 
 
10
 
11
  # Custom CSS for better styling
12
  custom_css = """
13
+ /* فایل CSS مدرن و حرفه‌ای برای سیستم تبدیل متن فارسی به گفتار */
14
+
15
  .gradio-container {
16
+ background: linear-gradient(135deg, #f0f4fc 0%, #d4e2f9 100%);
17
+ font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
18
+ color: #334155;
19
  }
20
 
21
  .main-header {
22
+ color: #1e3a8a;
23
  text-align: center;
24
+ margin: 1.5rem 0 2.5rem;
25
+ font-size: 2.4rem;
26
+ font-weight: 700;
27
+ text-shadow: 0px 2px 4px rgba(0,0,0,0.1);
28
+ position: relative;
29
+ }
30
+
31
+ .main-header:after {
32
+ content: "";
33
+ display: block;
34
+ width: 120px;
35
+ height: 4px;
36
+ background: linear-gradient(90deg, #3b82f6, #2563eb);
37
+ margin: 1rem auto;
38
+ border-radius: 2px;
39
  }
40
 
41
  .container {
42
+ max-width: 1000px;
43
+ margin: 0 auto 2rem;
44
+ padding: 2rem;
45
+ background-color: rgba(255, 255, 255, 0.92);
46
+ border-radius: 20px;
47
+ box-shadow: 0 15px 35px rgba(49, 52, 125, 0.12), 0 5px 15px rgba(0, 0, 0, 0.05);
48
+ backdrop-filter: blur(10px);
49
+ border: 1px solid rgba(255, 255, 255, 0.6);
50
  }
51
 
52
  .footer {
53
  text-align: center;
54
+ margin-top: 2.5rem;
55
+ color: #475569;
56
+ font-size: 0.95rem;
57
+ line-height: 1.6;
58
+ padding: 0 1rem;
59
  }
60
 
61
  /* Persian text alignment */
 
64
  direction: rtl;
65
  }
66
 
67
+ .label {
68
+ font-size: 1.25rem !important;
69
+ font-weight: 600 !important;
70
+ color: #1e40af !important;
71
+ margin-bottom: 0.75rem !important;
72
+ display: block;
73
+ }
74
+
75
  /* Button styling */
76
  button.primary {
77
+ background: linear-gradient(45deg, #3b82f6, #4f46e5) !important;
78
+ border: none !important;
79
+ border-radius: 12px !important;
80
+ color: white !important;
81
+ font-weight: 600 !important;
82
+ font-size: 1.05rem !important;
83
+ padding: 0.6rem 1.5rem !important;
84
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
85
+ box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
86
  }
87
 
88
  button.primary:hover {
89
+ transform: translateY(-3px) !important;
90
+ box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4) !important;
91
+ background: linear-gradient(45deg, #2563eb, #4338ca) !important;
92
+ }
93
+
94
+ button.primary:active {
95
+ transform: translateY(0) !important;
96
  }
97
 
98
+ /* Panels styling */
99
  .input-panel, .output-panel {
100
  background-color: rgba(255, 255, 255, 0.9);
101
+ border-radius: 16px;
102
+ padding: 1.5rem;
103
+ margin-bottom: 1.5rem;
104
  border: 1px solid #e2e8f0;
105
+ transition: all 0.3s ease;
106
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
107
+ }
108
+
109
+ .input-panel:hover, .output-panel:hover {
110
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
111
+ border-color: #cbd5e1;
112
+ }
113
+
114
+ /* Textbox styling */
115
+ .input-text textarea {
116
+ border: 2px solid #e2e8f0 !important;
117
+ border-radius: 12px !important;
118
+ padding: 1rem !important;
119
+ transition: all 0.3s ease !important;
120
+ font-size: 1.05rem !important;
121
+ background-color: rgba(255, 255, 255, 0.8) !important;
122
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05) !important;
123
+ }
124
+
125
+ .input-text textarea:focus {
126
+ border-color: #60a5fa !important;
127
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.05) !important;
128
+ background-color: rgba(255, 255, 255, 0.95) !important;
129
+ }
130
+
131
+ /* Slider styling */
132
+ .speed-slider input[type="range"] {
133
+ height: 8px !important;
134
+ border-radius: 8px !important;
135
+ background: linear-gradient(90deg, #bfdbfe, #93c5fd) !important;
136
+ }
137
+
138
+ .speed-slider input[type="range"]::-webkit-slider-thumb {
139
+ background: #3b82f6 !important;
140
+ border: 3px solid white !important;
141
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) !important;
142
+ height: 20px !important;
143
+ width: 20px !important;
144
+ }
145
+
146
+ .speed-slider .label {
147
+ font-size: 1rem !important;
148
+ color: #334155 !important;
149
+ font-weight: 500 !important;
150
  }
151
 
152
  .examples-panel {
153
+ background-color: rgba(241, 245, 249, 0.7);
154
+ border-radius: 16px;
155
+ padding: 1.5rem;
156
  border: 1px solid #e2e8f0;
157
+ margin-top: 2rem;
158
  }
159
 
160
  .status-panel {
161
+ background: linear-gradient(45deg, #f1f5f9, #e2e8f0);
162
+ border-radius: 12px;
163
+ padding: 1rem;
164
+ margin-bottom: 1.5rem;
165
  text-align: center;
166
+ font-weight: 500;
167
+ border-right: 4px solid #3b82f6;
168
+ transition: all 0.3s ease;
169
+ }
170
+
171
+ /* Status messages */
172
+ #status:contains("✅") {
173
+ color: #16a34a;
174
+ background: linear-gradient(45deg, #f0fdf4, #dcfce7);
175
+ border-right-color: #16a34a;
176
+ }
177
+
178
+ #status:contains("❌") {
179
+ color: #dc2626;
180
+ background: linear-gradient(45deg, #fef2f2, #fee2e2);
181
+ border-right-color: #dc2626;
182
+ }
183
+
184
+ #status:contains("در حال") {
185
+ color: #2563eb;
186
+ background: linear-gradient(45deg, #eff6ff, #dbeafe);
187
+ border-right-color: #2563eb;
188
+ }
189
+
190
+ /* Audio player styling */
191
+ audio {
192
+ border-radius: 12px !important;
193
+ background: linear-gradient(to right, #dbeafe, #e0e7ff) !important;
194
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
195
+ width: 100% !important;
196
+ }
197
+
198
+ /* Examples styling */
199
+ .examples-panel button {
200
+ border: 1px solid #cbd5e1 !important;
201
+ background: rgba(255, 255, 255, 0.7) !important;
202
+ border-radius: 8px !important;
203
+ transition: all 0.2s ease !important;
204
+ }
205
+
206
+ .examples-panel button:hover {
207
+ background: white !important;
208
+ border-color: #93c5fd !important;
209
+ transform: translateY(-2px) !important;
210
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05) !important;
211
+ }
212
+
213
+ /* Animation effects */
214
+ @keyframes fadeIn {
215
+ from { opacity: 0; transform: translateY(10px); }
216
+ to { opacity: 1; transform: translateY(0); }
217
+ }
218
+
219
+ .container {
220
+ animation: fadeIn 0.6s ease-out;
221
+ }
222
+
223
+ /* Wave effect for audio processing */
224
+ @keyframes wave {
225
+ 0% { background-position: 0% 50%; }
226
+ 50% { background-position: 100% 50%; }
227
+ 100% { background-position: 0% 50%; }
228
+ }
229
+
230
+ #status:contains("در حال تبدیل") {
231
+ background-size: 200% 200%;
232
+ animation: wave 2s ease infinite;
233
+ background-image: linear-gradient(45deg, #dbeafe, #eff6ff, #dbeafe);
234
+ }
235
+
236
+ /* RTL support for all UI elements */
237
+ .gradio-container [dir="rtl"],
238
+ .gradio-container [style*="direction: rtl"] {
239
+ font-family: 'Vazirmatn', 'Tahoma', sans-serif !important;
240
+ }
241
+
242
+ /* Responsive adjustments */
243
+ @media (max-width: 768px) {
244
+ .container {
245
+ padding: 1.5rem;
246
+ margin: 0 1rem 1.5rem;
247
+ }
248
+
249
+ .main-header {
250
+ font-size: 1.8rem;
251
+ }
252
+
253
+ .label {
254
+ font-size: 1.1rem !important;
255
+ }
256
  }
257
  """
258