yuangongfdu commited on
Commit
b8b03ab
1 Parent(s): cdcbb14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -9,13 +9,14 @@ paper_text = "[Paper]"
9
  model = whisper.load_model("tiny")
10
  print('model loaded')
11
 
 
 
 
 
 
 
12
  def predict(audio_path, time_resolution):
13
- def round_time_resolution(time_resolution):
14
- multiple = float(time_resolution) / 0.4
15
- rounded_multiple = round(multiple)
16
- rounded_time_resolution = rounded_multiple * 0.4
17
- return rounded_time_resolution
18
- # audio_tagging_time_resolution = round_time_resolution(time_resolution)
19
  # result = model.transcribe(audio_path, at_time_res=audio_tagging_time_resolution)
20
  # # ASR Results
21
  # print(result["text"])
@@ -31,7 +32,7 @@ def predict(audio_path, time_resolution):
31
  # print(segment)
32
  # at_output = at_output + str(segment['time']['start']) + 's-' + str(segment['time']['end']) + 's: ' + ','.join([x[0] for x in segment['audio tags']]) + '\n'
33
  # print(at_output)
34
- asr_output, at_output = 's', 'k'
35
  return asr_output, at_output
36
 
37
  iface = gr.Interface(fn=predict,
 
9
  model = whisper.load_model("tiny")
10
  print('model loaded')
11
 
12
+ def round_time_resolution(time_resolution):
13
+ multiple = float(time_resolution) / 0.4
14
+ rounded_multiple = round(multiple)
15
+ rounded_time_resolution = rounded_multiple * 0.4
16
+ return rounded_time_resolution
17
+
18
  def predict(audio_path, time_resolution):
19
+ audio_tagging_time_resolution = round_time_resolution(time_resolution)
 
 
 
 
 
20
  # result = model.transcribe(audio_path, at_time_res=audio_tagging_time_resolution)
21
  # # ASR Results
22
  # print(result["text"])
 
32
  # print(segment)
33
  # at_output = at_output + str(segment['time']['start']) + 's-' + str(segment['time']['end']) + 's: ' + ','.join([x[0] for x in segment['audio tags']]) + '\n'
34
  # print(at_output)
35
+ asr_output, at_output = str(audio_tagging_time_resolution), 'k'
36
  return asr_output, at_output
37
 
38
  iface = gr.Interface(fn=predict,