DevNumb commited on
Commit
56f6bc2
·
verified ·
1 Parent(s): ebb49bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -68
app.py CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import numpy as np
3
  import tempfile
@@ -208,67 +221,6 @@ input[type="range"]::-webkit-slider-thumb {
208
  font-weight: 600;
209
  }
210
 
211
- /* Tabs */
212
- .tabs {
213
- background: white;
214
- border-radius: 16px;
215
- padding: 0.5rem;
216
- margin-top: 1rem;
217
- border: 1px solid #E5E7EB;
218
- }
219
-
220
- .tab-btn {
221
- background: transparent;
222
- border: none;
223
- color: #6B7280;
224
- padding: 0.75rem 1.25rem;
225
- border-radius: 10px;
226
- cursor: pointer;
227
- font-weight: 500;
228
- transition: all 0.2s;
229
- margin: 0 0.25rem;
230
- }
231
-
232
- .tab-btn.selected {
233
- background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
234
- color: white;
235
- }
236
-
237
- /* Dropdown */
238
- select {
239
- background: white !important;
240
- border: 2px solid #D1D5DB !important;
241
- border-radius: 10px !important;
242
- color: #374151 !important;
243
- padding: 0.75rem !important;
244
- font-size: 0.95rem !important;
245
- width: 100% !important;
246
- cursor: pointer !important;
247
- }
248
-
249
- select:focus {
250
- border-color: #4F46E5 !important;
251
- outline: none !important;
252
- }
253
-
254
- /* Markdown content - BLACK TEXT */
255
- .markdown {
256
- color: #374151 !important;
257
- line-height: 1.6 !important;
258
- }
259
-
260
- .markdown h1, .markdown h2, .markdown h3 {
261
- color: #111827 !important;
262
- font-weight: 600 !important;
263
- margin-top: 1.5em !important;
264
- margin-bottom: 0.5em !important;
265
- }
266
-
267
- .markdown p {
268
- color: #4B5563 !important;
269
- margin-bottom: 1em !important;
270
- }
271
-
272
  /* Status messages */
273
  .status-success {
274
  background: #DCFCE7 !important;
@@ -344,6 +296,24 @@ select:focus {
344
  .col-2 {
345
  flex: 2;
346
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  </style>
348
  """
349
 
@@ -678,11 +648,26 @@ with gr.Blocks() as demo:
678
  outputs=[stats_display]
679
  )
680
 
681
- # Launch the app
682
  if __name__ == "__main__":
683
- demo.launch(
684
- server_name="0.0.0.0",
685
- server_port=7860,
686
- show_error=True,
687
- quiet=True
688
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import platform
3
+ import sys
4
+
5
+ # Fix for "ValueError: Invalid file descriptor: -1" on shutdown
6
+ if platform.system() != 'Windows':
7
+ try:
8
+ # This policy has been reported to fix the issue in Linux/Unix environments
9
+ asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
10
+ except AttributeError:
11
+ pass # Ignore if policy can't be set
12
+
13
+ # Now import other modules
14
  import gradio as gr
15
  import numpy as np
16
  import tempfile
 
221
  font-weight: 600;
222
  }
223
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  /* Status messages */
225
  .status-success {
226
  background: #DCFCE7 !important;
 
296
  .col-2 {
297
  flex: 2;
298
  }
299
+
300
+ /* Markdown content - BLACK TEXT */
301
+ .markdown {
302
+ color: #374151 !important;
303
+ line-height: 1.6 !important;
304
+ }
305
+
306
+ .markdown h1, .markdown h2, .markdown h3 {
307
+ color: #111827 !important;
308
+ font-weight: 600 !important;
309
+ margin-top: 1.5em !important;
310
+ margin-bottom: 0.5em !important;
311
+ }
312
+
313
+ .markdown p {
314
+ color: #4B5563 !important;
315
+ margin-bottom: 1em !important;
316
+ }
317
  </style>
318
  """
319
 
 
648
  outputs=[stats_display]
649
  )
650
 
651
+ # Launch the app with proper cleanup
652
  if __name__ == "__main__":
653
+ try:
654
+ demo.launch(
655
+ server_name="0.0.0.0",
656
+ server_port=7860,
657
+ show_error=True,
658
+ quiet=True,
659
+ debug=False # Disable debug mode for cleaner shutdown
660
+ )
661
+ except KeyboardInterrupt:
662
+ print("\n👋 Shutting down VibeVoice TTS...")
663
+ # Clean shutdown
664
+ try:
665
+ import asyncio
666
+ loop = asyncio.get_event_loop()
667
+ if loop.is_running():
668
+ loop.stop()
669
+ except:
670
+ pass
671
+ print("✅ Shutdown complete!")
672
+ except Exception as e:
673
+ print(f"❌ Error: {e}")