sotirios-slv commited on
Commit
7e182ab
·
1 Parent(s): 04716fa

Added textbox for unprocessed transcription string

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -10,10 +10,6 @@ from transformers import (
10
  )
11
 
12
 
13
- # diction_text = """
14
- # How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon? which hold out seductions somewhat more dangerous, methinks, to honest labor than those presented by a library; or in listless inaction, in weary unoccupied solitude? That cannot be. While man is a social animal society he must have, and better a thousand times that he should seek relief from the tedium of unemployed hours in the improving conversation of worthy authors, dead or living, than in the debasing, brutalising communications from which it is so difficult otherwise to escape.
15
- # """
16
-
17
  diction_text = """
18
  How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon?
19
  which hold out seductions somewhat more dangerous, methinks, to honest labour than those presented by a library...
@@ -26,7 +22,6 @@ device = "cpu"
26
 
27
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
28
 
29
- # model_id = "openai/whisper-base "
30
  model_id = "openai/whisper-large-v3"
31
 
32
  description = f"""
@@ -87,17 +82,20 @@ def transcribe_audio(diction_text, audio):
87
 
88
  formatted_score = f"{str(round(score,3))}%"
89
 
90
- return diff_text, formatted_score
 
 
 
91
 
92
 
93
  highlighted_results = gr.HighlightedText(
94
  label="Diff",
95
  combine_adjacent=True,
96
  show_legend=True,
97
- color_map={"+": "red", "-": "green"},
98
  )
99
 
100
- score = gr.Textbox("0%", label="Score")
101
 
102
 
103
  input_audio = gr.Audio(
@@ -113,7 +111,7 @@ input_audio = gr.Audio(
113
 
114
  demo = gr.Interface(
115
  fn=transcribe_audio,
116
- inputs=[diction_script, input_audio],
117
  outputs=[highlighted_results, score],
118
  title="Redmond Barry-oke",
119
  description=description,
 
10
  )
11
 
12
 
 
 
 
 
13
  diction_text = """
14
  How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon?
15
  which hold out seductions somewhat more dangerous, methinks, to honest labour than those presented by a library...
 
22
 
23
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
24
 
 
25
  model_id = "openai/whisper-large-v3"
26
 
27
  description = f"""
 
82
 
83
  formatted_score = f"{str(round(score,3))}%"
84
 
85
+ return diction_text, diff_text, formatted_score
86
+
87
+
88
+ transcribed_text = gr.Textbox(label="Transcribed text")
89
 
90
 
91
  highlighted_results = gr.HighlightedText(
92
  label="Diff",
93
  combine_adjacent=True,
94
  show_legend=True,
95
+ color_map={"+": "green", "-": "red"},
96
  )
97
 
98
+ score = gr.Textbox("0%", label="Barry-oke score")
99
 
100
 
101
  input_audio = gr.Audio(
 
111
 
112
  demo = gr.Interface(
113
  fn=transcribe_audio,
114
+ inputs=[transcribed_text, diction_script, input_audio],
115
  outputs=[highlighted_results, score],
116
  title="Redmond Barry-oke",
117
  description=description,