medelharchaoui commited on
Commit
9c6e277
1 Parent(s): 7812e4e

adjust output audio and narrator output

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -13,15 +13,19 @@ def describe_image(file_path):
13
  img_text_pip_output = img_text_pipe(file_path)
14
 
15
  description_text = img_text_pip_output[0]['generated_text']
 
16
 
17
  narrated_text = narrator(description_text)
 
 
18
 
19
- return narrated_text["audio"][0]
 
20
 
21
 
22
  iface = gr.Interface(fn=describe_image,
23
  inputs=gr.Image(label="Input image",
24
  type="pil"),
25
- outputs="audio"
26
  )
27
  iface.launch()
 
13
  img_text_pip_output = img_text_pipe(file_path)
14
 
15
  description_text = img_text_pip_output[0]['generated_text']
16
+ print(description_text)
17
 
18
  narrated_text = narrator(description_text)
19
+
20
+ (narrated_text["sampling_rate"], narrated_text["audio"][0] )
21
 
22
+ return (narrated_text["sampling_rate"], narrated_text["audio"][0])
23
+
24
 
25
 
26
  iface = gr.Interface(fn=describe_image,
27
  inputs=gr.Image(label="Input image",
28
  type="pil"),
29
+ outputs=gr.Audio(label="Narration", type="numpy", autoplay=True)
30
  )
31
  iface.launch()