aichina commited on
Commit
e5be212
1 Parent(s): 483fdec
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -21,6 +21,14 @@ headers = {
21
 
22
  # response = requests.post('https://api.gladia.io/audio/text/audio-transcription/', headers=headers, files=files)
23
 
 
 
 
 
 
 
 
 
24
 
25
  def get_audio(url):
26
  print(f'{url} start get audio ...')
@@ -39,10 +47,8 @@ def get_transcript(url, model_size, lang, format):
39
  'language_behaviour': (None, 'automatic single language'),
40
  }
41
  response = requests.post('https://api.gladia.io/audio/text/audio-transcription/', headers=headers, files=files)
42
- return response.text
43
 
44
-
45
-
46
  def get_transcript2(url, model_size, lang, format):
47
 
48
 
 
21
 
22
  # response = requests.post('https://api.gladia.io/audio/text/audio-transcription/', headers=headers, files=files)
23
 
24
+ def convert(res):
25
+ data = res.json()
26
+ prediction = data['prediction']
27
+ content = []
28
+ for x in prediction:
29
+ content.append(x['transcription'])
30
+ return '\n'.join(content)
31
+
32
 
33
  def get_audio(url):
34
  print(f'{url} start get audio ...')
 
47
  'language_behaviour': (None, 'automatic single language'),
48
  }
49
  response = requests.post('https://api.gladia.io/audio/text/audio-transcription/', headers=headers, files=files)
50
+ return convert(response)
51
 
 
 
52
  def get_transcript2(url, model_size, lang, format):
53
 
54