Skip to content

Commit

Permalink
refactor: cleanup clip vqa skill.
Browse files Browse the repository at this point in the history
  • Loading branch information
jws-1 committed Apr 18, 2024
1 parent 8c6373d commit 26e4db1
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions skills/src/lasr_skills/clip_vqa.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/env python3

import smach
from smach import UserData
from typing import Union
from lasr_skills import Say
from lasr_vision_clip.srv import VqaRequest, VqaResponse, Vqa
import rospy


class QueryImage(smach.State):
Expand All @@ -28,38 +27,3 @@ def execute(self, userdata: UserData):
userdata.answer = response.answer
userdata.similarity_score = response.similarity
return "succeeded"


if __name__ == "__main__":
import rospy

rospy.init_node("test_query_image")
sm = smach.StateMachine(outcomes=["succeeded", "failed"])
with sm:
smach.StateMachine.add(
"QUERY_IMAGE",
QueryImage(),
transitions={
"succeeded": "SAY",
"failed": "failed",
},
remapping={
"answers": "answers",
"answer": "answer",
"similarity_score": "similarity_score",
},
)
smach.StateMachine.add(
"SAY",
Say(format_str="I think the answer is {}"),
transitions={
"succeeded": "succeeded",
"aborted": "failed",
"preempted": "failed",
},
remapping={
"placeholders": "answer",
},
)
sm.userdata.answers = ["a person wearing glasses", "a person not wearing glasses"]
sm.execute()

0 comments on commit 26e4db1

Please sign in to comment.