gospacedev commited on
Commit
5126c5a
1 Parent(s): 022c8c1

globalize histories on generate and transcribe functions

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -29,6 +29,8 @@ pipe = pipeline(
29
 
30
 
31
  def generate(user_prompt, temperature=0.1, max_new_tokens=128, top_p=0.95, repetition_penalty=1.0):
 
 
32
  temperature = float(temperature)
33
  if temperature < 1e-2:
34
  temperature = 1e-2
@@ -53,7 +55,8 @@ def generate(user_prompt, temperature=0.1, max_new_tokens=128, top_p=0.95, repet
53
 
54
 
55
  @spaces.GPU(duration=60)
56
- def transcribe(audio, formatted_history, instruct_history):
 
57
  sr, y = audio
58
  y = y.astype(np.float32)
59
  y /= np.max(np.abs(y))
@@ -91,7 +94,7 @@ with gr.Blocks() as demo:
91
  transcription_box = gr.Textbox(
92
  formatted_history, label="Transcription")
93
 
94
- transcribe_btn.click(fn=transcribe, inputs=[audio_input, formatted_history, instruct_history],
95
  outputs=[output_audio])
96
 
97
 
 
29
 
30
 
31
  def generate(user_prompt, temperature=0.1, max_new_tokens=128, top_p=0.95, repetition_penalty=1.0):
32
+ global formatted_history
33
+
34
  temperature = float(temperature)
35
  if temperature < 1e-2:
36
  temperature = 1e-2
 
55
 
56
 
57
  @spaces.GPU(duration=60)
58
+ def transcribe(audio):
59
+ global instruct_history, formatted_history
60
  sr, y = audio
61
  y = y.astype(np.float32)
62
  y /= np.max(np.abs(y))
 
94
  transcription_box = gr.Textbox(
95
  formatted_history, label="Transcription")
96
 
97
+ transcribe_btn.click(fn=transcribe, inputs=[audio_input],
98
  outputs=[output_audio])
99
 
100