Havyle commited on
Commit
e2e277e
·
verified ·
1 Parent(s): f1d545e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -20,7 +20,6 @@ except Exception as e:
20
  asr_pipeline = None
21
 
22
  # --- Load ViT5 Translation ---
23
- # Lưu ý: Đảm bảo bạn đã upload các file model ra ngoài cùng (root)
24
  TRANSLATION_MODEL_PATH = "."
25
 
26
  print(f"Đang tải model dịch...")
@@ -81,7 +80,7 @@ def full_pipeline(audio, text_input, mode):
81
  # 3. GIAO DIỆN COFFEE THEME (UI/UX)
82
  # ==========================================
83
 
84
- # CSS Tông màu Cà phê (Nâu - Be - Kem)
85
  custom_css = """
86
  @import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400&family=Roboto:wght@300;400;500&display=swap');
87
 
@@ -90,24 +89,26 @@ body {
90
  background-color: #fdfbf7;
91
  }
92
 
 
93
  .header-container {
94
  background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
95
  padding: 30px;
96
  border-radius: 15px;
97
- color: #fff8e1;
98
  text-align: center;
99
  box-shadow: 0 6px 12px rgba(62, 39, 35, 0.3);
100
  margin-bottom: 25px;
101
  border-bottom: 4px solid #8d6e63;
102
  }
103
 
 
104
  .uni-name {
105
  font-family: 'Roboto', sans-serif;
106
- font-size: 14px;
107
  text-transform: uppercase;
108
  letter-spacing: 2px;
109
- opacity: 0.9;
110
- color: #d7ccc8;
 
111
  }
112
 
113
  .project-name {
@@ -116,18 +117,20 @@ body {
116
  font-weight: 700;
117
  margin: 15px 0;
118
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
 
119
  }
120
 
121
  .author-name {
122
  font-size: 14px;
123
  font-style: italic;
124
- color: #efebe9;
125
- border-top: 1px solid rgba(255,255,255,0.2);
126
  display: inline-block;
127
  padding-top: 10px;
128
  margin-top: 5px;
129
  }
130
 
 
131
  button.primary-btn {
132
  background-color: #6d4c41 !important;
133
  color: white !important;
@@ -143,6 +146,7 @@ button.primary-btn:hover {
143
  box-shadow: 0 6px 10px rgba(109, 76, 65, 0.3);
144
  }
145
 
 
146
  .label-text {
147
  font-weight: bold;
148
  color: #4e342e;
@@ -169,19 +173,17 @@ button.primary-btn:hover {
169
  }
170
  """
171
 
172
- # TẠO THEME (SỬA LỖI ĐÂY)
173
- # Thay vì dùng colors.brown (không có ở bản cũ), ta dùng "orange" và "gray"
174
- # Sau đó dùng .set() để ghi đè mã màu chính xác
175
  coffee_theme = gr.themes.Soft(
176
- primary_hue="orange", # Thay thế cho brown
177
  secondary_hue="yellow",
178
- neutral_hue="gray", # Thay thế cho stone
179
  ).set(
180
  body_background_fill="#fcf9f2",
181
  block_background_fill="#ffffff",
182
  block_border_width="1px",
183
  block_shadow="0 2px 4px rgba(0,0,0,0.05)",
184
- button_primary_background_fill="#6d4c41", # Màu nâu cà phê
185
  button_primary_background_fill_hover="#5d4037",
186
  button_primary_text_color="white",
187
  slider_color="#8d6e63"
@@ -254,7 +256,7 @@ with gr.Blocks(css=custom_css, theme=coffee_theme, title="VSL Coffee Translator"
254
  lines=2
255
  )
256
 
257
- gr.HTML("<br>") # Khoảng cách
258
 
259
  # Kết quả cuối cùng
260
  gr.Label("Bước 2: Cú pháp Ký hiệu (VSL)", show_label=False, color="red")
 
20
  asr_pipeline = None
21
 
22
  # --- Load ViT5 Translation ---
 
23
  TRANSLATION_MODEL_PATH = "."
24
 
25
  print(f"Đang tải model dịch...")
 
80
  # 3. GIAO DIỆN COFFEE THEME (UI/UX)
81
  # ==========================================
82
 
83
+ # CSS Tông màu Cà phê (Sửa lại màu chữ Header)
84
  custom_css = """
85
  @import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400&family=Roboto:wght@300;400;500&display=swap');
86
 
 
89
  background-color: #fdfbf7;
90
  }
91
 
92
+ /* --- HEADER --- */
93
  .header-container {
94
  background: linear-gradient(135deg, #3e2723 0%, #5d4037 100%);
95
  padding: 30px;
96
  border-radius: 15px;
 
97
  text-align: center;
98
  box-shadow: 0 6px 12px rgba(62, 39, 35, 0.3);
99
  margin-bottom: 25px;
100
  border-bottom: 4px solid #8d6e63;
101
  }
102
 
103
+ /* Ép màu trắng bằng !important */
104
  .uni-name {
105
  font-family: 'Roboto', sans-serif;
106
+ font-size: 16px;
107
  text-transform: uppercase;
108
  letter-spacing: 2px;
109
+ color: #ffffff !important; /* Màu trắng */
110
+ font-weight: bold;
111
+ opacity: 0.9;
112
  }
113
 
114
  .project-name {
 
117
  font-weight: 700;
118
  margin: 15px 0;
119
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
120
+ color: #ffffff !important; /* Màu trắng */
121
  }
122
 
123
  .author-name {
124
  font-size: 14px;
125
  font-style: italic;
126
+ color: #ffffff !important; /* Màu trắng */
127
+ border-top: 1px solid rgba(255,255,255,0.3);
128
  display: inline-block;
129
  padding-top: 10px;
130
  margin-top: 5px;
131
  }
132
 
133
+ /* --- BUTTONS --- */
134
  button.primary-btn {
135
  background-color: #6d4c41 !important;
136
  color: white !important;
 
146
  box-shadow: 0 6px 10px rgba(109, 76, 65, 0.3);
147
  }
148
 
149
+ /* --- OTHER --- */
150
  .label-text {
151
  font-weight: bold;
152
  color: #4e342e;
 
173
  }
174
  """
175
 
176
+ # Tạo Theme (Sử dụng màu cơ bản để tránh lỗi phiên bản)
 
 
177
  coffee_theme = gr.themes.Soft(
178
+ primary_hue="orange",
179
  secondary_hue="yellow",
180
+ neutral_hue="gray",
181
  ).set(
182
  body_background_fill="#fcf9f2",
183
  block_background_fill="#ffffff",
184
  block_border_width="1px",
185
  block_shadow="0 2px 4px rgba(0,0,0,0.05)",
186
+ button_primary_background_fill="#6d4c41",
187
  button_primary_background_fill_hover="#5d4037",
188
  button_primary_text_color="white",
189
  slider_color="#8d6e63"
 
256
  lines=2
257
  )
258
 
259
+ gr.HTML("<br>")
260
 
261
  # Kết quả cuối cùng
262
  gr.Label("Bước 2: Cú pháp Ký hiệu (VSL)", show_label=False, color="red")