Skip to content

Commit

Permalink
Integrate object detection with chat-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-ai-integration[bot] committed Jul 16, 2024
1 parent 385530c commit a3592c6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from model import LanguageModelConfig, TransformerConfig, QuantizedWeight8bit as QW8Bit
from runners import InferenceRunner, ModelRunner, sample_from_model
from object_detection.detect import detect_objects


CKPT_PATH = "./checkpoints/"
Expand Down Expand Up @@ -62,8 +63,20 @@ def main():
inference_runner.initialize()
gen = inference_runner.run()

inp = "The answer to life the universe and everything is of course"
print(f"Output for prompt: {inp}", sample_from_model(gen, inp, max_len=100, temperature=0.01))
while True:
user_input = input("User: ")
if user_input.lower() == "quit":
break

image_path = input("Enter image path (or press Enter to skip): ")
if image_path:
detected_objects = detect_objects(image_path)
prompt = f"Detected objects: {detected_objects}\n{user_input}"
else:
prompt = user_input

response = sample_from_model(gen, prompt, max_len=100, temperature=0.01)
print(f"AI: {response}")


if __name__ == "__main__":
Expand Down

0 comments on commit a3592c6

Please sign in to comment.