jilijeanlouis commited on
Commit
5eb3657
1 Parent(s): 5c867fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -72,12 +72,17 @@ def transcribe(
72
  # and other debugging detailed element you might be
73
  # interested in
74
 
 
75
  segments = response.json()["prediction"]
76
 
77
  output = ""
78
-
79
  for segment in segments:
80
- output = output + " " + segment["transcription"]
 
 
 
 
81
 
82
 
83
  return output, response.json()["prediction_raw"]
@@ -97,7 +102,7 @@ iface = gr.Interface(
97
  inputs=[
98
  gr.Audio(label="Audio file", source="upload", type="filepath"),
99
  ],
100
- outputs=["text", "json"]
101
  examples=[
102
  ["examples/good.will.hunting.wav"],
103
  ["examples/wolf.of.wall.street.wav"],
 
72
  # and other debugging detailed element you might be
73
  # interested in
74
 
75
+
76
  segments = response.json()["prediction"]
77
 
78
  output = ""
79
+ current_speaker = ""
80
  for segment in segments:
81
+ if segment["speaker"] != current_speaker and segment["speaker"]!= "unknown":
82
+ current_speaker = segment["speaker"]
83
+ output = output + "<br/><br/><b>" + segment["speaker"] + ":</b> " + segment["transcription"]
84
+ else:
85
+ output = output + " " + segment["transcription"]
86
 
87
 
88
  return output, response.json()["prediction_raw"]
 
102
  inputs=[
103
  gr.Audio(label="Audio file", source="upload", type="filepath"),
104
  ],
105
+ outputs=["html", "json"],
106
  examples=[
107
  ["examples/good.will.hunting.wav"],
108
  ["examples/wolf.of.wall.street.wav"],