uploading audio and video to azureBlobStorage

#27
by Banuka - opened
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -1,5 +1,8 @@
1
  import gradio as gr
2
  import os
 
 
 
3
 
4
  def predict_video(input_video, input_audio=None):
5
  global filename, file_size # Use the global keyword to refer to the global variables
@@ -15,9 +18,12 @@ def predict_video(input_video, input_audio=None):
15
  if not filename.lower().endswith('.mp4'):
16
  return [None, "Error: Please upload an MP4 video file."]
17
 
18
- if file_size > 16 * 1024 * 1024:
19
  return [None, "Error: The upload exceeds file size 16MB. Please upload a smaller file."]
20
 
 
 
 
21
  """
22
  Processes the uploaded video (replace with your video analysis logic).
23
 
@@ -35,6 +41,7 @@ def predict_video(input_video, input_audio=None):
35
 
36
  if input_audio is None:
37
  return [input_video, message + " Generated Audio will be used"]
 
38
  return [input_video, message + f" Using uploaded audio: {input_audio.name}"]
39
 
40
 
@@ -86,5 +93,4 @@ with gr.Blocks(css=css) as demo:
86
  queue=False
87
  )
88
 
89
-
90
- demo.launch(debug=True)
 
1
  import gradio as gr
2
  import os
3
+ import AzureBlobStorageVideo
4
+ import AzureBlobStorageAudio
5
+
6
 
7
  def predict_video(input_video, input_audio=None):
8
  global filename, file_size # Use the global keyword to refer to the global variables
 
18
  if not filename.lower().endswith('.mp4'):
19
  return [None, "Error: Please upload an MP4 video file."]
20
 
21
+ if file_size > 20 * 1024 * 1024:
22
  return [None, "Error: The upload exceeds file size 16MB. Please upload a smaller file."]
23
 
24
+ #upload the video to AzureBlobStorage
25
+ AzureBlobStorageVideo.uploadUserVideoToBlobStorage(input_video,"test6")
26
+
27
  """
28
  Processes the uploaded video (replace with your video analysis logic).
29
 
 
41
 
42
  if input_audio is None:
43
  return [input_video, message + " Generated Audio will be used"]
44
+ AzureBlobStorageAudio.uploadUserAudioToBlobStorage(input_audio,"test8")
45
  return [input_video, message + f" Using uploaded audio: {input_audio.name}"]
46
 
47
 
 
93
  queue=False
94
  )
95
 
96
+ demo.launch(debug=True)