Merge branch 'modal-integration-fix' into 'main'
Browse filesAdd logging for error handling and enhance audio file inputs in Gradio UI
See merge request sonne-technology/bsod-tv/waveform-matching-gradio-front-end!15
app.py
CHANGED
|
@@ -9,9 +9,12 @@ import os
|
|
| 9 |
import time
|
| 10 |
import wave
|
| 11 |
import modal
|
|
|
|
| 12 |
import contextlib
|
| 13 |
import gradio as gr
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def process_audio(original_audio_path, dubbed_audio_path, email, company_name, tolerance):
|
| 17 |
"""
|
|
@@ -48,7 +51,8 @@ def process_audio(original_audio_path, dubbed_audio_path, email, company_name, t
|
|
| 48 |
batch.put_file(original_audio_path, "/{}/original_audio.wav".format(processing_id))
|
| 49 |
batch.put_file(dubbed_audio_path, "/{}/dubbed_audio.wav".format(processing_id))
|
| 50 |
bsodtv_storage.commit()
|
| 51 |
-
except:
|
|
|
|
| 52 |
return "Error uploading audio files to Cloud Storage."
|
| 53 |
# 3. Call modal to trigger processing
|
| 54 |
try:
|
|
@@ -272,9 +276,9 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue
|
|
| 272 |
# First Row: Half Original Audio Input, Half Dubbed Audio Input
|
| 273 |
with gr.Row(elem_classes="input-section"):
|
| 274 |
with gr.Column(scale=1):
|
| 275 |
-
original_audio = gr.Audio(type="filepath", label="Original .wav file")
|
| 276 |
with gr.Column(scale=1):
|
| 277 |
-
dubbed_audio = gr.Audio(type="filepath", label="Dubbed .wav file")
|
| 278 |
|
| 279 |
# Second Row: 2/3 Email Input 1/3 Company Name Input
|
| 280 |
with gr.Row(elem_classes="input-section"):
|
|
|
|
| 9 |
import time
|
| 10 |
import wave
|
| 11 |
import modal
|
| 12 |
+
import logging
|
| 13 |
import contextlib
|
| 14 |
import gradio as gr
|
| 15 |
|
| 16 |
+
logging.basicConfig(level=logging.DEBUG)
|
| 17 |
+
logger = logging.getLogger(__name__)
|
| 18 |
|
| 19 |
def process_audio(original_audio_path, dubbed_audio_path, email, company_name, tolerance):
|
| 20 |
"""
|
|
|
|
| 51 |
batch.put_file(original_audio_path, "/{}/original_audio.wav".format(processing_id))
|
| 52 |
batch.put_file(dubbed_audio_path, "/{}/dubbed_audio.wav".format(processing_id))
|
| 53 |
bsodtv_storage.commit()
|
| 54 |
+
except Exception as e:
|
| 55 |
+
logger.error(f"Error uploading audio files to Modal Storage: {e}")
|
| 56 |
return "Error uploading audio files to Cloud Storage."
|
| 57 |
# 3. Call modal to trigger processing
|
| 58 |
try:
|
|
|
|
| 276 |
# First Row: Half Original Audio Input, Half Dubbed Audio Input
|
| 277 |
with gr.Row(elem_classes="input-section"):
|
| 278 |
with gr.Column(scale=1):
|
| 279 |
+
original_audio = gr.Audio(type="filepath", label="Original .wav file", sources=['upload'],format=".wav")
|
| 280 |
with gr.Column(scale=1):
|
| 281 |
+
dubbed_audio = gr.Audio(type="filepath", label="Dubbed .wav file", sources=['upload'],format=".wav")
|
| 282 |
|
| 283 |
# Second Row: 2/3 Email Input 1/3 Company Name Input
|
| 284 |
with gr.Row(elem_classes="input-section"):
|