(self, text, state)
| 1516 | return gr.update(visible = True), gr.update(visible = False), gr.update(placeholder=place), gr.update(value=label_clear) |
| 1517 | |
| 1518 | def run_text(self, text, state): |
| 1519 | self.agent.memory.buffer = cut_dialogue_history(self.agent.memory.buffer, keep_last_n_words=500) |
| 1520 | res = self.agent({"input": text.strip()}) |
| 1521 | res['output'] = res['output'].replace("\\", "/") |
| 1522 | response = re.sub('(image/[-\w]*.png)', lambda m: f'})*{m.group(0)}*', res['output']) |
| 1523 | state = state + [(text, response)] |
| 1524 | print(f"\nProcessed run_text, Input text: {text}\nCurrent state: {state}\n" |
| 1525 | f"Current Memory: {self.agent.memory.buffer}") |
| 1526 | return state, state |
| 1527 | |
| 1528 | def run_image(self, image, state, txt, lang): |
| 1529 | image_filename = os.path.join('image', f"{str(uuid.uuid4())[:8]}.png") |
nothing calls this directly
no test coverage detected