Spaces:
Sleeping
Sleeping
Commit ·
2cbbf1f
1
Parent(s): 990149f
Update design
Browse files
app.py
CHANGED
|
@@ -29,159 +29,173 @@ def transcribe(audio, model_choice):
|
|
| 29 |
def clear_all():
|
| 30 |
return None, "Whisper (Recommended)", ""
|
| 31 |
|
| 32 |
-
# Custom CSS with
|
| 33 |
custom_css = """
|
| 34 |
/*
|
| 35 |
-
|
| 36 |
-
-
|
| 37 |
-
-
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
-
-
|
| 41 |
-
-
|
| 42 |
-
-
|
|
|
|
|
|
|
|
|
|
| 43 |
*/
|
| 44 |
|
| 45 |
/* Global Styles */
|
| 46 |
.gradio-container {
|
| 47 |
-
background: #
|
| 48 |
font-family: 'Georgia', 'Times New Roman', serif !important;
|
| 49 |
-
color: #
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
/* Header Styling */
|
| 53 |
.header-section {
|
| 54 |
-
background: #
|
| 55 |
-
border: 2px solid #
|
| 56 |
-
border-radius:
|
| 57 |
padding: 30px;
|
| 58 |
margin-bottom: 25px;
|
| 59 |
-
box-shadow: 0
|
| 60 |
}
|
| 61 |
|
| 62 |
.header-section h1 {
|
| 63 |
-
color: #
|
| 64 |
-
font-size: 2.
|
| 65 |
-
font-weight:
|
| 66 |
text-align: center;
|
| 67 |
margin-bottom: 15px;
|
| 68 |
-
border-bottom: 3px solid #
|
| 69 |
padding-bottom: 15px;
|
|
|
|
| 70 |
}
|
| 71 |
|
| 72 |
.header-section p {
|
| 73 |
-
color: #
|
| 74 |
font-size: 1.1em;
|
| 75 |
text-align: center;
|
| 76 |
margin: 8px 0;
|
| 77 |
-
line-height: 1.
|
| 78 |
}
|
| 79 |
|
| 80 |
/* Main Content Cards */
|
| 81 |
.input-card, .output-card {
|
| 82 |
-
background: #
|
| 83 |
-
border: 2px solid #
|
| 84 |
-
border-radius:
|
| 85 |
padding: 25px;
|
| 86 |
-
box-shadow: 0
|
| 87 |
margin-bottom: 20px;
|
| 88 |
}
|
| 89 |
|
| 90 |
/* Button Styling */
|
| 91 |
.primary-button {
|
| 92 |
-
background: #
|
| 93 |
-
border: 2px solid #
|
| 94 |
-
border-radius:
|
| 95 |
-
padding:
|
| 96 |
-
font-size: 1em !important;
|
| 97 |
font-weight: 600 !important;
|
| 98 |
color: #ffffff !important;
|
| 99 |
-
transition: all 0.
|
|
|
|
| 100 |
}
|
| 101 |
|
| 102 |
.primary-button:hover {
|
| 103 |
-
background: #
|
| 104 |
-
border-color: #
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
|
| 107 |
.secondary-button {
|
| 108 |
-
background: #
|
| 109 |
-
border: 2px solid #
|
| 110 |
-
border-radius:
|
| 111 |
-
padding:
|
| 112 |
-
font-size:
|
| 113 |
font-weight: 500 !important;
|
| 114 |
color: #ffffff !important;
|
| 115 |
-
transition: all 0.
|
| 116 |
}
|
| 117 |
|
| 118 |
.secondary-button:hover {
|
| 119 |
-
background: #
|
| 120 |
-
border-color: #
|
|
|
|
| 121 |
}
|
| 122 |
|
| 123 |
/* Component Styling */
|
| 124 |
.audio-component, .dropdown-component {
|
| 125 |
-
border-radius:
|
| 126 |
-
border: 2px solid #
|
| 127 |
-
background: #
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
/* Text Styling */
|
| 131 |
.output-text {
|
| 132 |
-
background: #
|
| 133 |
-
border-radius:
|
| 134 |
-
border: 2px solid #
|
| 135 |
padding: 20px !important;
|
| 136 |
-
font-size:
|
| 137 |
-
line-height: 1.
|
| 138 |
-
font-family: 'Courier New', monospace !important;
|
| 139 |
-
color: #
|
| 140 |
}
|
| 141 |
|
| 142 |
/* Features Section */
|
| 143 |
.features-section {
|
| 144 |
-
background: #
|
| 145 |
-
border: 2px solid #
|
| 146 |
-
border-radius:
|
| 147 |
padding: 25px;
|
| 148 |
margin-top: 25px;
|
| 149 |
-
box-shadow: 0
|
| 150 |
}
|
| 151 |
|
| 152 |
.feature-item {
|
| 153 |
-
margin-bottom:
|
| 154 |
-
color: #
|
| 155 |
-
font-size:
|
| 156 |
-
line-height: 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
}
|
| 158 |
|
| 159 |
.feature-item strong {
|
| 160 |
-
color: #
|
| 161 |
}
|
| 162 |
|
| 163 |
/* Typography */
|
| 164 |
h3 {
|
| 165 |
font-family: 'Georgia', 'Times New Roman', serif !important;
|
| 166 |
-
color: #
|
| 167 |
font-weight: 600 !important;
|
| 168 |
margin-bottom: 15px !important;
|
| 169 |
}
|
| 170 |
|
| 171 |
/* Component Overrides */
|
| 172 |
label {
|
| 173 |
-
color: #
|
| 174 |
font-weight: 500 !important;
|
| 175 |
font-family: 'Georgia', 'Times New Roman', serif !important;
|
| 176 |
}
|
| 177 |
|
| 178 |
::placeholder {
|
| 179 |
-
color: #
|
| 180 |
-
opacity: 0.
|
| 181 |
}
|
| 182 |
|
| 183 |
*:focus {
|
| 184 |
-
outline: 2px solid #
|
| 185 |
outline-offset: 2px !important;
|
| 186 |
}
|
| 187 |
|
|
@@ -189,23 +203,69 @@ label {
|
|
| 189 |
.gradio-textbox textarea,
|
| 190 |
.gradio-dropdown,
|
| 191 |
.gradio-audio {
|
| 192 |
-
border: 2px solid #
|
| 193 |
-
border-radius:
|
| 194 |
-
background: #
|
| 195 |
-
color: #
|
| 196 |
font-family: inherit !important;
|
| 197 |
}
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
/* Responsive Design */
|
| 200 |
@media (max-width: 768px) {
|
| 201 |
.header-section h1 {
|
| 202 |
-
font-size:
|
| 203 |
}
|
| 204 |
|
| 205 |
.input-card, .output-card {
|
| 206 |
padding: 20px;
|
| 207 |
margin-bottom: 15px;
|
| 208 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
}
|
| 210 |
"""
|
| 211 |
|
|
@@ -223,7 +283,7 @@ with gr.Blocks(css=custom_css, title="CS-ASR | Code-Switching Speech Recognition
|
|
| 223 |
with gr.Row():
|
| 224 |
# Input Section
|
| 225 |
with gr.Column(scale=1, elem_classes="input-card"):
|
| 226 |
-
gr.HTML("<h3 style='color: #
|
| 227 |
|
| 228 |
audio_input = gr.Audio(
|
| 229 |
sources=["microphone", "upload"],
|
|
@@ -234,10 +294,10 @@ with gr.Blocks(css=custom_css, title="CS-ASR | Code-Switching Speech Recognition
|
|
| 234 |
|
| 235 |
model_selector = gr.Dropdown(
|
| 236 |
choices=[
|
| 237 |
-
"Whisper
|
| 238 |
-
"Wav2Vec2
|
| 239 |
],
|
| 240 |
-
value="Whisper
|
| 241 |
label="Select AI Model",
|
| 242 |
elem_classes="dropdown-component",
|
| 243 |
info="Choose the model that best fits your needs"
|
|
@@ -259,7 +319,7 @@ with gr.Blocks(css=custom_css, title="CS-ASR | Code-Switching Speech Recognition
|
|
| 259 |
|
| 260 |
# Output Section
|
| 261 |
with gr.Column(scale=1, elem_classes="output-card"):
|
| 262 |
-
gr.HTML("<h3 style='color: #
|
| 263 |
|
| 264 |
output_text = gr.Textbox(
|
| 265 |
label="Your Transcription Will Appear Here",
|
|
@@ -272,7 +332,7 @@ with gr.Blocks(css=custom_css, title="CS-ASR | Code-Switching Speech Recognition
|
|
| 272 |
# Features Section
|
| 273 |
with gr.Column(elem_classes="features-section"):
|
| 274 |
gr.HTML("""
|
| 275 |
-
<h3 style='color: #
|
| 276 |
<div style='display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px;'>
|
| 277 |
<div class='feature-item'>
|
| 278 |
<strong>Dual Model Support:</strong> Choose between Whisper and Wav2Vec2 for optimal results
|
|
|
|
| 29 |
def clear_all():
|
| 30 |
return None, "Whisper (Recommended)", ""
|
| 31 |
|
| 32 |
+
# Custom CSS with dark theme
|
| 33 |
custom_css = """
|
| 34 |
/*
|
| 35 |
+
DARK THEME COLOR PALETTE:
|
| 36 |
+
- Background: #000000 (Pure black - main background)
|
| 37 |
+
- Surface Dark: #1a1a1a (Dark gray - cards, containers)
|
| 38 |
+
- Surface Medium: #2d2d2d (Medium gray - inputs, components)
|
| 39 |
+
- Border: #404040 (Gray - borders, dividers)
|
| 40 |
+
- Text Primary: #ffffff (White - main text, headers)
|
| 41 |
+
- Text Secondary: #b0b0b0 (Light gray - secondary text)
|
| 42 |
+
- Accent: #4a9eff (Blue - buttons, highlights)
|
| 43 |
+
- Accent Hover: #357abd (Darker blue - hover states)
|
| 44 |
+
- Success: #28a745 (Green - success states)
|
| 45 |
+
- Warning: #ffc107 (Yellow - warnings)
|
| 46 |
*/
|
| 47 |
|
| 48 |
/* Global Styles */
|
| 49 |
.gradio-container {
|
| 50 |
+
background: #000000 !important;
|
| 51 |
font-family: 'Georgia', 'Times New Roman', serif !important;
|
| 52 |
+
color: #ffffff !important;
|
| 53 |
+
min-height: 100vh !important;
|
| 54 |
}
|
| 55 |
|
| 56 |
/* Header Styling */
|
| 57 |
.header-section {
|
| 58 |
+
background: #1a1a1a;
|
| 59 |
+
border: 2px solid #404040;
|
| 60 |
+
border-radius: 12px;
|
| 61 |
padding: 30px;
|
| 62 |
margin-bottom: 25px;
|
| 63 |
+
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
|
| 64 |
}
|
| 65 |
|
| 66 |
.header-section h1 {
|
| 67 |
+
color: #ffffff !important;
|
| 68 |
+
font-size: 2.4em !important;
|
| 69 |
+
font-weight: 700 !important;
|
| 70 |
text-align: center;
|
| 71 |
margin-bottom: 15px;
|
| 72 |
+
border-bottom: 3px solid #4a9eff;
|
| 73 |
padding-bottom: 15px;
|
| 74 |
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
| 75 |
}
|
| 76 |
|
| 77 |
.header-section p {
|
| 78 |
+
color: #b0b0b0;
|
| 79 |
font-size: 1.1em;
|
| 80 |
text-align: center;
|
| 81 |
margin: 8px 0;
|
| 82 |
+
line-height: 1.6;
|
| 83 |
}
|
| 84 |
|
| 85 |
/* Main Content Cards */
|
| 86 |
.input-card, .output-card {
|
| 87 |
+
background: #1a1a1a;
|
| 88 |
+
border: 2px solid #404040;
|
| 89 |
+
border-radius: 12px;
|
| 90 |
padding: 25px;
|
| 91 |
+
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
|
| 92 |
margin-bottom: 20px;
|
| 93 |
}
|
| 94 |
|
| 95 |
/* Button Styling */
|
| 96 |
.primary-button {
|
| 97 |
+
background: linear-gradient(135deg, #4a9eff, #357abd) !important;
|
| 98 |
+
border: 2px solid #4a9eff !important;
|
| 99 |
+
border-radius: 8px !important;
|
| 100 |
+
padding: 14px 28px !important;
|
| 101 |
+
font-size: 1.1em !important;
|
| 102 |
font-weight: 600 !important;
|
| 103 |
color: #ffffff !important;
|
| 104 |
+
transition: all 0.3s ease !important;
|
| 105 |
+
box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3) !important;
|
| 106 |
}
|
| 107 |
|
| 108 |
.primary-button:hover {
|
| 109 |
+
background: linear-gradient(135deg, #357abd, #2a5d8f) !important;
|
| 110 |
+
border-color: #357abd !important;
|
| 111 |
+
transform: translateY(-2px) !important;
|
| 112 |
+
box-shadow: 0 6px 16px rgba(74, 158, 255, 0.4) !important;
|
| 113 |
}
|
| 114 |
|
| 115 |
.secondary-button {
|
| 116 |
+
background: #2d2d2d !important;
|
| 117 |
+
border: 2px solid #404040 !important;
|
| 118 |
+
border-radius: 8px !important;
|
| 119 |
+
padding: 12px 24px !important;
|
| 120 |
+
font-size: 1em !important;
|
| 121 |
font-weight: 500 !important;
|
| 122 |
color: #ffffff !important;
|
| 123 |
+
transition: all 0.3s ease !important;
|
| 124 |
}
|
| 125 |
|
| 126 |
.secondary-button:hover {
|
| 127 |
+
background: #404040 !important;
|
| 128 |
+
border-color: #555555 !important;
|
| 129 |
+
transform: translateY(-1px) !important;
|
| 130 |
}
|
| 131 |
|
| 132 |
/* Component Styling */
|
| 133 |
.audio-component, .dropdown-component {
|
| 134 |
+
border-radius: 8px !important;
|
| 135 |
+
border: 2px solid #404040 !important;
|
| 136 |
+
background: #2d2d2d !important;
|
| 137 |
+
color: #ffffff !important;
|
| 138 |
}
|
| 139 |
|
| 140 |
/* Text Styling */
|
| 141 |
.output-text {
|
| 142 |
+
background: #2d2d2d !important;
|
| 143 |
+
border-radius: 8px !important;
|
| 144 |
+
border: 2px solid #404040 !important;
|
| 145 |
padding: 20px !important;
|
| 146 |
+
font-size: 1.05em !important;
|
| 147 |
+
line-height: 1.7 !important;
|
| 148 |
+
font-family: 'Consolas', 'Courier New', monospace !important;
|
| 149 |
+
color: #ffffff !important;
|
| 150 |
}
|
| 151 |
|
| 152 |
/* Features Section */
|
| 153 |
.features-section {
|
| 154 |
+
background: #1a1a1a;
|
| 155 |
+
border: 2px solid #404040;
|
| 156 |
+
border-radius: 12px;
|
| 157 |
padding: 25px;
|
| 158 |
margin-top: 25px;
|
| 159 |
+
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
|
| 160 |
}
|
| 161 |
|
| 162 |
.feature-item {
|
| 163 |
+
margin-bottom: 15px;
|
| 164 |
+
color: #b0b0b0;
|
| 165 |
+
font-size: 1.05em;
|
| 166 |
+
line-height: 1.6;
|
| 167 |
+
padding: 10px;
|
| 168 |
+
background: #2d2d2d;
|
| 169 |
+
border-radius: 6px;
|
| 170 |
+
border-left: 4px solid #4a9eff;
|
| 171 |
}
|
| 172 |
|
| 173 |
.feature-item strong {
|
| 174 |
+
color: #ffffff;
|
| 175 |
}
|
| 176 |
|
| 177 |
/* Typography */
|
| 178 |
h3 {
|
| 179 |
font-family: 'Georgia', 'Times New Roman', serif !important;
|
| 180 |
+
color: #ffffff !important;
|
| 181 |
font-weight: 600 !important;
|
| 182 |
margin-bottom: 15px !important;
|
| 183 |
}
|
| 184 |
|
| 185 |
/* Component Overrides */
|
| 186 |
label {
|
| 187 |
+
color: #ffffff !important;
|
| 188 |
font-weight: 500 !important;
|
| 189 |
font-family: 'Georgia', 'Times New Roman', serif !important;
|
| 190 |
}
|
| 191 |
|
| 192 |
::placeholder {
|
| 193 |
+
color: #808080 !important;
|
| 194 |
+
opacity: 0.8;
|
| 195 |
}
|
| 196 |
|
| 197 |
*:focus {
|
| 198 |
+
outline: 2px solid #4a9eff !important;
|
| 199 |
outline-offset: 2px !important;
|
| 200 |
}
|
| 201 |
|
|
|
|
| 203 |
.gradio-textbox textarea,
|
| 204 |
.gradio-dropdown,
|
| 205 |
.gradio-audio {
|
| 206 |
+
border: 2px solid #404040 !important;
|
| 207 |
+
border-radius: 8px !important;
|
| 208 |
+
background: #2d2d2d !important;
|
| 209 |
+
color: #ffffff !important;
|
| 210 |
font-family: inherit !important;
|
| 211 |
}
|
| 212 |
|
| 213 |
+
.gradio-textbox textarea:focus,
|
| 214 |
+
.gradio-dropdown:focus,
|
| 215 |
+
.gradio-audio:focus {
|
| 216 |
+
border-color: #4a9eff !important;
|
| 217 |
+
box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2) !important;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
/* Scrollbar Styling */
|
| 221 |
+
::-webkit-scrollbar {
|
| 222 |
+
width: 8px;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
::-webkit-scrollbar-track {
|
| 226 |
+
background: #1a1a1a;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
::-webkit-scrollbar-thumb {
|
| 230 |
+
background: #404040;
|
| 231 |
+
border-radius: 4px;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
::-webkit-scrollbar-thumb:hover {
|
| 235 |
+
background: #4a9eff;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
/* Selection Styling */
|
| 239 |
+
::selection {
|
| 240 |
+
background: #4a9eff;
|
| 241 |
+
color: #ffffff;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
/* Responsive Design */
|
| 245 |
@media (max-width: 768px) {
|
| 246 |
.header-section h1 {
|
| 247 |
+
font-size: 2em !important;
|
| 248 |
}
|
| 249 |
|
| 250 |
.input-card, .output-card {
|
| 251 |
padding: 20px;
|
| 252 |
margin-bottom: 15px;
|
| 253 |
}
|
| 254 |
+
|
| 255 |
+
.primary-button, .secondary-button {
|
| 256 |
+
padding: 12px 20px !important;
|
| 257 |
+
font-size: 0.95em !important;
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
/* Animation for better UX */
|
| 262 |
+
@keyframes fadeIn {
|
| 263 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 264 |
+
to { opacity: 1; transform: translateY(0); }
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
.input-card, .output-card, .features-section, .header-section {
|
| 268 |
+
animation: fadeIn 0.5s ease-out;
|
| 269 |
}
|
| 270 |
"""
|
| 271 |
|
|
|
|
| 283 |
with gr.Row():
|
| 284 |
# Input Section
|
| 285 |
with gr.Column(scale=1, elem_classes="input-card"):
|
| 286 |
+
gr.HTML("<h3 style='color: #ffffff; margin-bottom: 20px; font-weight: 600;'>Audio Input</h3>")
|
| 287 |
|
| 288 |
audio_input = gr.Audio(
|
| 289 |
sources=["microphone", "upload"],
|
|
|
|
| 294 |
|
| 295 |
model_selector = gr.Dropdown(
|
| 296 |
choices=[
|
| 297 |
+
"Whisper Model",
|
| 298 |
+
"Wav2Vec2 Model"
|
| 299 |
],
|
| 300 |
+
value="Whisper Model",
|
| 301 |
label="Select AI Model",
|
| 302 |
elem_classes="dropdown-component",
|
| 303 |
info="Choose the model that best fits your needs"
|
|
|
|
| 319 |
|
| 320 |
# Output Section
|
| 321 |
with gr.Column(scale=1, elem_classes="output-card"):
|
| 322 |
+
gr.HTML("<h3 style='color: #ffffff; margin-bottom: 20px; font-weight: 600;'>Transcription Result</h3>")
|
| 323 |
|
| 324 |
output_text = gr.Textbox(
|
| 325 |
label="Your Transcription Will Appear Here",
|
|
|
|
| 332 |
# Features Section
|
| 333 |
with gr.Column(elem_classes="features-section"):
|
| 334 |
gr.HTML("""
|
| 335 |
+
<h3 style='color: #ffffff; margin-bottom: 20px; font-weight: 600; text-align: center;'>Key Features</h3>
|
| 336 |
<div style='display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px;'>
|
| 337 |
<div class='feature-item'>
|
| 338 |
<strong>Dual Model Support:</strong> Choose between Whisper and Wav2Vec2 for optimal results
|