Skip to content

Commit

Permalink
support GroundingDINO and segment-anything
Browse files Browse the repository at this point in the history
  • Loading branch information
jordddan committed Apr 17, 2023
1 parent 23fbef9 commit c79588b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
langchain==0.0.101
torch==1.13.1
torchvision==0.14.1
gradio==3.20.1
wget==3.2
accelerate
addict
Expand All @@ -10,6 +9,7 @@ basicsr
controlnet-aux
diffusers
einops
gradio
imageio
imageio-ffmpeg
invisible-watermark
Expand Down
4 changes: 2 additions & 2 deletions visual_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ def run_text(self, text, state):
self.agent.memory.buffer = cut_dialogue_history(self.agent.memory.buffer, keep_last_n_words=500)
res = self.agent({"input": text.strip()})
res['output'] = res['output'].replace("\\", "/")
response = re.sub('(image/[-\w]*.png)', lambda m: f'![](/file={m.group(0)})*{m.group(0)}*', res['output'])
response = re.sub('(image/[-\w]*.png)', lambda m: f'![](file={m.group(0)})*{m.group(0)}*', res['output'])
state = state + [(text, response)]
print(f"\nProcessed run_text, Input text: {text}\nCurrent state: {state}\n"
f"Current Memory: {self.agent.memory.buffer}")
Expand All @@ -1333,7 +1333,7 @@ def run_image(self, image, state, txt, lang):
Human_prompt = f'\nHuman: provide a figure named {image_filename}. The description is: {description}. This information helps you to understand this image, but you should use tools to finish following tasks, rather than directly imagine from my description. If you understand, say \"Received\". \n'
AI_prompt = "Received. "
self.agent.memory.buffer = self.agent.memory.buffer + Human_prompt + 'AI: ' + AI_prompt
state = state + [(f"![](/file={image_filename})*{image_filename}*", AI_prompt)]
state = state + [(f"![](file={image_filename})*{image_filename}*", AI_prompt)]
print(f"\nProcessed run_image, Input image: {image_filename}\nCurrent state: {state}\n"
f"Current Memory: {self.agent.memory.buffer}")
return state, state, f'{txt} {image_filename} '
Expand Down

0 comments on commit c79588b

Please sign in to comment.