Skip to content

Commit

Permalink
take picture debug for libcamera
Browse files Browse the repository at this point in the history
  • Loading branch information
hbarnard committed Dec 14, 2022
1 parent 833983a commit 76470d3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Binary file modified __pycache__/intent_server.cpython-39.pyc
Binary file not shown.
Binary file modified db/memories.db
Binary file not shown.
15 changes: 9 additions & 6 deletions intent_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,31 +115,34 @@ async def info(info : Request):
else:
mu.curl_speak(config['en_prompts']['nope'])

logging.debug('is when this event was logged.')
logging.debug('--->is when this event was logged.')

#FIXME: Not quite sure what purpose this serves?
return {
"status" : "SUCCESS",
"data" : req_info
}

logging.debug('<---is when this event returns.')

# take a photo and store it

def run_photo_command(number,please):

print("take photo found") if config['main']['debug'] else None

# FIXME: nice to have websocket notification
#command = config['main']['xdg_open_command'] + '?type=thinking'
#xdg_open_array = command.split()
# subprocess.call(xdg_open_array, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

cur = con.cursor()
# picture = local[config['main']['picture_program']]
picture = subprocess.check_output(config['main']['picture_program'])
print('picture is: ' + picture.decode("utf-8"))
result = picture()
(text, file_path) = result.split('|')
file_path.rstrip()
result = subprocess.check_output(config['main']['picture_program'])
print(result.decode())
res = result.decode()
[text, file_path] = res.split("|")
#file_path.rstrip()
unix_time = int(datetime.datetime.now().timestamp())
cur.execute("INSERT INTO memories (description, text, file_path, unix_time, public, owner, type) values (?, ?,?, ?, ?, ?,? )", (text, text, file_path, unix_time, 0, 1, 'photo'))
con.commit()
Expand Down
3 changes: 3 additions & 0 deletions take_picture.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def main():
model = replicate.models.get("j-min/clip-caption-reward")
result = model.predict(image=image_file)
mu.curl_speak(config['en_prompts']['done'])
else:
mu.curl_speak(config['en_prompts']['done'])


dots.deinit() if pi else None
print(result + "|" + media_path)
Expand Down

0 comments on commit 76470d3

Please sign in to comment.