denizaybey commited on
Commit
0613be4
·
1 Parent(s): 728bb1d

Revamp UI with custom theme, CSS, and Blocks interface for improved design and usability

Browse files

- Integrated a professional dark theme and Golden ratio-based proportions.
- Added custom CSS for enhanced visual styling and responsiveness.
- Migrated from the basic Gradio `Interface` to `Blocks` for advanced layout control.
- Updated `requirements.txt` to include `pillow` for additional features.
- Added `logo.png` for branding.

Files changed (3) hide show
  1. app.py +230 -15
  2. logo.png +0 -0
  3. requirements.txt +2 -1
app.py CHANGED
@@ -65,21 +65,236 @@ def process_audio(original_audio_path, dubbed_audio_path, email, company_name, t
65
  return "Processing started. Results will be emailed to you shortly."
66
 
67
 
68
- # Create the Gradio interface for the application.
69
- demo = gr.Interface(
70
- fn=process_audio,
71
- inputs=[
72
- gr.Audio(type="filepath", label="Original .wav file"),
73
- gr.Audio(type="filepath", label="Dubbed .wav file"),
74
- gr.Textbox(label="Email"),
75
- gr.Textbox(label="Company Name"),
76
- gr.Slider(0, 100, value=5, label="Tolerance Percentage", info="Set the tolerance for audio comparison.")
77
- ],
78
- outputs=gr.Text(label="Processing Status"),
79
- title="BSOD.tv - Dub QC Demo",
80
- description="Upload original and dubbed .wav files (under 30 minutes) to start the QC process.",
81
- allow_flagging="never"
82
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  if __name__ == "__main__":
85
  # To run this file locally, you'll need to install gradio and requests:
 
65
  return "Processing started. Results will be emailed to you shortly."
66
 
67
 
68
+ # Create a professional Gradio interface using the Golden ratio (1.618) for proportions
69
+ # Define custom CSS for a professional look
70
+ css = """
71
+ :root {
72
+ --main-bg-color: #111827;
73
+ --primary-color: #3B82F6;
74
+ --secondary-color: #60A5FA;
75
+ --text-color: #F9FAFB;
76
+ --text-secondary: #9CA3AF;
77
+ --card-bg: #1F2937;
78
+ --border-color: #374151;
79
+ --accent-blue: #3B82F6;
80
+ --accent-yellow: #FBBF24;
81
+ --accent-red: #EF4444;
82
+ --accent-green: #22C55E;
83
+ --border-radius: 8px;
84
+ --golden-ratio: 1.618;
85
+ --font-header: 'Barlow', sans-serif;
86
+ --font-body: 'Work Sans', sans-serif;
87
+ }
88
+
89
+ body {
90
+ font-family: var(--font-body);
91
+ background-color: var(--main-bg-color);
92
+ color: var(--text-color);
93
+ }
94
+
95
+ .container {
96
+ max-width: 1200px;
97
+ margin: 0 auto;
98
+ padding: calc(20px * var(--golden-ratio));
99
+ background-color: var(--main-bg-color);
100
+ border-radius: calc(var(--border-radius) * var(--golden-ratio));
101
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
102
+ }
103
+
104
+ .logo-container {
105
+ display: flex;
106
+ justify-content: center;
107
+ margin-bottom: calc(20px * var(--golden-ratio));
108
+ padding: 15px;
109
+ background-color: var(--card-bg);
110
+ border-radius: var(--border-radius);
111
+ border: 1px solid var(--border-color);
112
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
113
+ }
114
+
115
+ .logo {
116
+ max-width: 200px;
117
+ max-height: 100px;
118
+ transition: transform 0.3s ease;
119
+ }
120
+
121
+ .logo:hover {
122
+ transform: scale(1.05);
123
+ }
124
+
125
+ .header {
126
+ text-align: center;
127
+ margin-bottom: calc(30px * var(--golden-ratio));
128
+ padding: calc(15px * var(--golden-ratio));
129
+ background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
130
+ color: white;
131
+ border-radius: var(--border-radius);
132
+ box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
133
+ }
134
+
135
+ .header h1 {
136
+ color: white;
137
+ font-family: var(--font-header);
138
+ font-size: calc(1.5rem * var(--golden-ratio));
139
+ margin-bottom: calc(0.5rem * var(--golden-ratio));
140
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
141
+ font-weight: 600;
142
+ }
143
+
144
+ .header p {
145
+ color: rgba(255, 255, 255, 0.9);
146
+ font-size: 1rem;
147
+ max-width: calc(600px * var(--golden-ratio));
148
+ margin: 0 auto;
149
+ }
150
+
151
+ .input-section, .output-section {
152
+ background-color: var(--card-bg);
153
+ border: 1px solid var(--border-color);
154
+ border-radius: var(--border-radius);
155
+ padding: calc(20px * var(--golden-ratio));
156
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
157
+ margin-bottom: 20px;
158
+ transition: all 0.3s ease;
159
+ }
160
+
161
+ .input-section:hover, .output-section:hover {
162
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
163
+ border-color: var(--primary-color);
164
+ }
165
+
166
+ .input-section {
167
+ flex: var(--golden-ratio);
168
+ }
169
+
170
+ .output-section {
171
+ flex: 1;
172
+ }
173
+
174
+ .footer {
175
+ text-align: center;
176
+ margin-top: calc(30px * var(--golden-ratio));
177
+ padding: 15px;
178
+ color: var(--text-secondary);
179
+ font-size: 0.9rem;
180
+ border-top: 1px solid var(--border-color);
181
+ }
182
+
183
+ /* Improve form elements */
184
+ .gradio-slider input[type=range] {
185
+ accent-color: var(--primary-color);
186
+ }
187
+
188
+ .gradio-textbox input, .gradio-textbox textarea {
189
+ background-color: var(--main-bg-color) !important;
190
+ border: 1px solid var(--border-color) !important;
191
+ border-radius: var(--border-radius) !important;
192
+ padding: 10px !important;
193
+ color: var(--text-color) !important;
194
+ transition: all 0.3s ease !important;
195
+ }
196
+
197
+ .gradio-textbox input:focus, .gradio-textbox textarea:focus {
198
+ border-color: var(--primary-color) !important;
199
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3) !important;
200
+ }
201
+
202
+ .gradio-button {
203
+ background-color: var(--primary-color) !important;
204
+ color: white !important;
205
+ border-radius: var(--border-radius) !important;
206
+ padding: calc(10px * var(--golden-ratio)) calc(20px * var(--golden-ratio)) !important;
207
+ font-weight: 600 !important;
208
+ font-family: var(--font-header) !important;
209
+ transition: all 0.3s ease !important;
210
+ box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3) !important;
211
+ border: none !important;
212
+ }
213
+
214
+ .gradio-button:hover {
215
+ background-color: var(--secondary-color) !important;
216
+ transform: translateY(-2px);
217
+ box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4) !important;
218
+ }
219
+
220
+ /* Golden ratio spacing for elements */
221
+ .gradio-row {
222
+ margin-bottom: calc(16px * var(--golden-ratio)) !important;
223
+ }
224
+
225
+ /* Additional dark theme adjustments */
226
+ .gradio-container {
227
+ background-color: var(--main-bg-color) !important;
228
+ }
229
+
230
+ .gradio-form {
231
+ background-color: var(--card-bg) !important;
232
+ border: 1px solid var(--border-color) !important;
233
+ }
234
+
235
+ /* Labels and text styling */
236
+ label {
237
+ color: var(--text-color) !important;
238
+ font-family: var(--font-body) !important;
239
+ }
240
+
241
+ /* Responsive adjustments */
242
+ @media (max-width: 768px) {
243
+ .container {
244
+ padding: 15px;
245
+ }
246
+
247
+ .input-section, .output-section {
248
+ padding: 15px;
249
+ }
250
+ }
251
+ """
252
+
253
+ # Create a Blocks interface for more customization
254
+ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue="purple")) as demo:
255
+ with gr.Column(elem_classes="container"):
256
+ # Logo section
257
+ with gr.Row(elem_classes="logo-container"):
258
+ logo = gr.Image("logo.png", elem_id="logo")
259
+
260
+ # Header section
261
+ with gr.Column(elem_classes="header"):
262
+ gr.HTML("""
263
+ <h1 style="margin-top: 0;">BSOD.tv - Dub QC Demo</h1>
264
+ <p style="font-size: 1.1rem; line-height: 1.618;">
265
+ Professional audio synchronization verification for media localization.
266
+ <br>Upload original and dubbed .wav files (under 30 minutes) to start the QC process.
267
+ </p>
268
+ """)
269
+
270
+ # Main content with Golden ratio proportions
271
+ with gr.Row():
272
+ # Input section (larger according to Golden ratio)
273
+ with gr.Column(scale=1.618, elem_classes="input-section"):
274
+ original_audio = gr.Audio(type="filepath", label="Original .wav file")
275
+ dubbed_audio = gr.Audio(type="filepath", label="Dubbed .wav file")
276
+ email = gr.Textbox(label="Email")
277
+ company_name = gr.Textbox(label="Company Name")
278
+ tolerance = gr.Slider(0, 100, value=5, label="Tolerance Percentage",
279
+ info="Set the tolerance for audio comparison.")
280
+ submit_btn = gr.Button("Process Audio", variant="primary")
281
+
282
+ # Output section (smaller according to Golden ratio)
283
+ with gr.Column(scale=1, elem_classes="output-section"):
284
+ output = gr.Text(label="Processing Status")
285
+ gr.Markdown("### Results")
286
+ gr.Markdown("Once processing is complete, results will be emailed to the address provided.")
287
+
288
+ # Footer
289
+ with gr.Row(elem_classes="footer"):
290
+ gr.Markdown("© BSOD.tv - Professional Dub Quality Control")
291
+
292
+ # Set up the processing function
293
+ submit_btn.click(
294
+ fn=process_audio,
295
+ inputs=[original_audio, dubbed_audio, email, company_name, tolerance],
296
+ outputs=output
297
+ )
298
 
299
  if __name__ == "__main__":
300
  # To run this file locally, you'll need to install gradio and requests:
logo.png ADDED
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio
2
- requests
 
 
1
  gradio
2
+ requests
3
+ pillow