lmzjms commited on
Commit
edf6130
1 Parent(s): 335ec14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -68,11 +68,19 @@ class ConversationBot:
68
  return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
69
  else:
70
  tool = res['intermediate_steps'][0][0].tool
71
- if tool == "Generate Image From User Input Text" or tool == "Generate Text From The Audio" or tool == "Transcribe speech":
 
 
 
 
 
 
 
 
72
  print("======>Current memory:\n %s" % self.agent.memory)
73
  response = re.sub('(image/\S*png)', lambda m: f'![](/file={m.group(0)})*{m.group(0)}*', res['output'])
74
  image_filename = res['intermediate_steps'][0][1]
75
- response = response + f"![](/file={image_filename})*{image_filename}*"
76
  state = state + [(text, response)]
77
  print("Outputs:", state)
78
  return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
 
68
  return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
69
  else:
70
  tool = res['intermediate_steps'][0][0].tool
71
+ if tool == "Generate Image From User Input Text":
72
+ print("======>Current memory:\n %s" % self.agent.memory)
73
+ # response = re.sub('(image/\S*png)', lambda m: f'![](/file={m.group(0)})*{m.group(0)}*', res['output'])
74
+ image_filename = res['intermediate_steps'][0][1]
75
+ response = res['output'] + f"![](/file={image_filename})"
76
+ state = state + [(text, response)]
77
+ print("Outputs:", state)
78
+ return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)
79
+ elif tool == "Generate Text From The Audio" or tool == "Transcribe speech":
80
  print("======>Current memory:\n %s" % self.agent.memory)
81
  response = re.sub('(image/\S*png)', lambda m: f'![](/file={m.group(0)})*{m.group(0)}*', res['output'])
82
  image_filename = res['intermediate_steps'][0][1]
83
+ #response = res['output'] + f"![](/file={image_filename})*{image_filename}*"
84
  state = state + [(text, response)]
85
  print("Outputs:", state)
86
  return state, state, gr.Audio.update(visible=False), gr.Image.update(visible=False), gr.Button.update(visible=False)