lmzjms commited on
Commit
329cb64
1 Parent(s): 06be3a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -93,7 +93,14 @@ class ConversationBot:
93
  print(f"\nProcessed run_text, Input text: {text}\nCurrent state: {state}\n"
94
  f"Current Memory: {self.agent.memory.buffer}")
95
  return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
96
- elif tool == "Generate Text From The Audio" or tool == "Transcribe speech" or tool == "Target Sound Detection" or tool == "Detect The Sound Event From The Audio":
 
 
 
 
 
 
 
97
  print("======>Current memory:\n %s" % self.agent.memory)
98
  response = re.sub('(image/\S*png)', lambda m: f'![](/file={m.group(0)})*{m.group(0)}*', res['output'])
99
  image_filename = res['intermediate_steps'][0][1]
 
93
  print(f"\nProcessed run_text, Input text: {text}\nCurrent state: {state}\n"
94
  f"Current Memory: {self.agent.memory.buffer}")
95
  return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
96
+ elif tool == "Detect The Sound Event From The Audio":
97
+ image_filename = res['intermediate_steps'][0][1]
98
+ response = res['output'] + f"![](/file={image_filename})*{image_filename}*"
99
+ state = state + [(text, response)]
100
+ print(f"\nProcessed run_text, Input text: {text}\nCurrent state: {state}\n"
101
+ f"Current Memory: {self.agent.memory.buffer}")
102
+ return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
103
+ elif tool == "Generate Text From The Audio" or tool == "Transcribe speech" or tool == "Target Sound Detection":
104
  print("======>Current memory:\n %s" % self.agent.memory)
105
  response = re.sub('(image/\S*png)', lambda m: f'![](/file={m.group(0)})*{m.group(0)}*', res['output'])
106
  image_filename = res['intermediate_steps'][0][1]