denizaybey commited on
Commit
3a2f952
·
2 Parent(s): 44729c9 96c1034

Merge branch 'modal-integration-fix' into 'main'

Browse files

Fix audio file naming and update dependency version

See merge request sonne-technology/bsod-tv/waveform-matching-gradio-front-end!14

Files changed (2) hide show
  1. app.py +7 -6
  2. requirements.txt +2 -2
app.py CHANGED
@@ -19,6 +19,7 @@ def process_audio(original_audio_path, dubbed_audio_path, email, company_name, t
19
  file upload to presigned URLs, and triggering the processing.
20
  """
21
  # 1. Check the duration of both audio files.
 
22
  modal_token_id = os.environ['MODAL_TOKEN_ID']
23
  modal_token_secret = os.environ['MODAL_TOKEN_SECRET']
24
  modal_environment = os.environ['MODAL_ENVIRONMENT']
@@ -45,7 +46,7 @@ def process_audio(original_audio_path, dubbed_audio_path, email, company_name, t
45
  bsodtv_storage = modal.Volume.from_name(modal_volume)
46
  with bsodtv_storage.batch_upload() as batch:
47
  batch.put_file(original_audio_path, "/{}/original_audio.wav".format(processing_id))
48
- batch.put_file(dubbed_audio_path, "/{}/original_audio.wav".format(processing_id))
49
  bsodtv_storage.commit()
50
  except:
51
  return "Error uploading audio files to Cloud Storage."
@@ -278,14 +279,14 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue
278
  # Second Row: 2/3 Email Input 1/3 Company Name Input
279
  with gr.Row(elem_classes="input-section"):
280
  with gr.Column(scale=2):
281
- email = gr.Textbox(label="Email")
282
  with gr.Column(scale=1):
283
- company_name = gr.Textbox(label="Company Name")
284
 
285
  # Third Row: Tolerance Percentage
286
  with gr.Row(elem_classes="input-section"):
287
- tolerance = gr.Slider(0, 100, value=5, label="Tolerance Percentage",
288
- info="Set the tolerance for audio comparison.")
289
 
290
  # Fourth Row: Processing Status
291
  with gr.Row(elem_classes="output-section"):
@@ -305,7 +306,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue
305
  # Set up the processing function
306
  submit_btn.click(
307
  fn=process_audio,
308
- inputs=[original_audio, dubbed_audio, email, company_name, tolerance],
309
  outputs=output
310
  )
311
 
 
19
  file upload to presigned URLs, and triggering the processing.
20
  """
21
  # 1. Check the duration of both audio files.
22
+ app = modal.App("Waveform-Matching")
23
  modal_token_id = os.environ['MODAL_TOKEN_ID']
24
  modal_token_secret = os.environ['MODAL_TOKEN_SECRET']
25
  modal_environment = os.environ['MODAL_ENVIRONMENT']
 
46
  bsodtv_storage = modal.Volume.from_name(modal_volume)
47
  with bsodtv_storage.batch_upload() as batch:
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."
 
279
  # Second Row: 2/3 Email Input 1/3 Company Name Input
280
  with gr.Row(elem_classes="input-section"):
281
  with gr.Column(scale=2):
282
+ _email = gr.Textbox(label="Email")
283
  with gr.Column(scale=1):
284
+ _company_name = gr.Textbox(label="Company Name")
285
 
286
  # Third Row: Tolerance Percentage
287
  with gr.Row(elem_classes="input-section"):
288
+ _tolerance = gr.Slider(0, 100, value=5, label="Tolerance Percentage",
289
+ info="Set the tolerance for audio comparison.")
290
 
291
  # Fourth Row: Processing Status
292
  with gr.Row(elem_classes="output-section"):
 
306
  # Set up the processing function
307
  submit_btn.click(
308
  fn=process_audio,
309
+ inputs=[original_audio, dubbed_audio, _email, _company_name, _tolerance],
310
  outputs=output
311
  )
312
 
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- modal
2
- gradio
 
1
+ modal==1.0.4
2
+ gradio