timer skill

main
samerbam 1 year ago
parent 666fbac971
commit 1d88e949c9

@ -13,7 +13,7 @@
- [ ] Gmail
- [ ] ChatGPT
- [ ] Reminders
- [ ] Timers
- [x] Timers - TODO: Adding in sound notifications.
- [ ] Todos
- [ ] Weather
- [ ] Wolfram
@ -28,8 +28,15 @@
- Cons of backend is large file transfers between devices, lots of internet usage
- Perks of frontend is less data transfer between devices requiring less internet usage
- Cons of frontend is slower generation
- Current Solution: https://github.com/synesthesiam/opentts
## API Specs
Using websockets for communication allows for two way communication where the server can send the client info at any point
Link for example: https://stackoverflow.com/questions/53331127/python-websockets-send-to-client-and-keep-connection-alive
More examples (includes jwt authentication, though this is in node.js, still useful for figuring out how to do this stuff): https://www.linode.com/docs/guides/authenticating-over-websockets-with-jwt/
## Ideas
* Dashboard with api call counts

@ -32,6 +32,9 @@
from transformers import pipeline
import spacy
from datetime import datetime
import time
# text = "When Sebastian Thrun started working on self-driving cars at Google in 2007, few people outside of the company took him seriously."
# doc = nlp(text)
@ -64,18 +67,50 @@ class NLP:
if __name__ == "__main__":
nlp = NLP(['travel', 'cooking', 'dancing', 'weather'])
starttime = time.time()
nlp = NLP(['weather', 'timer', 'physics', 'mathematics'])
print(f"Init: {time.time()-starttime}")
starttime = time.time()
print('==')
print(nlp.get_skill("one day I will see the world"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print("yay!")
print(nlp.get_skill("What is the weather today?"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print('==')
print(nlp.get_skill("What is air resistance of a spaceship with a mass of 1000kg"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print(nlp.get_skill("What is five plus five"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print('====')
print(nlp.get_named_entities("one day I will see the world"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print("yay!")
print(nlp.get_named_entities("What is the weather today in london?"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print('====')
print('======')
print(nlp.get_named_entities("set a timer for 1 minute and 15 seconds"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print(nlp.get_named_entities("remind me at May 5th at 2:30 in the afternoon to wash the dog"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print(nlp.get_skill("remind me at May 5th at 2:30 in the afternoon to wash the dog"))
print(f"Took: {time.time()-starttime}")
starttime = time.time()
print('======')
# sequence_to_classify = "one day I will see the world"
# candidate_labels = ['travel', 'cooking', 'dancing']
# print(classifier(sequence_to_classify, candidate_labels))

@ -84,7 +84,8 @@ class Timers:
self._remove_timer(name)
# #TODO: play timer done sound
# TODO: play timer done sound, send response on api saying to listen to ntfy.sh for signal to trigger sound.
# Better option for two way communication: WEBSOCKETS!
return schedule.CancelJob
def get_remaining_time(self, name=""): #TODO: test this function
@ -110,6 +111,6 @@ class Timers:
if __name__ == "__main__":
dur = Timers()
dur.run("add", "2 minutes", "test timer")
dur.run("add", "15 seconds", "test timer")
# dur._add_timer(123, "123")
# dur._trigger_timer("123")

@ -24,4 +24,7 @@ while True:
time.sleep(0.1)
# TODO: Make api request to backend with resulting text in callback function.
# TODO: Make api request to backend with resulting text in callback function.
# Use to connect to backend with bi-directional communication, allows for alarms/timers/etc to work:
# https://pypi.org/project/websocket-client/
Loading…
Cancel
Save