timer skill
This commit is contained in:
parent
30af7cdeab
commit
858788f5d7
@ -13,7 +13,7 @@
|
|||||||
- [ ] Gmail
|
- [ ] Gmail
|
||||||
- [ ] ChatGPT
|
- [ ] ChatGPT
|
||||||
- [ ] Reminders
|
- [ ] Reminders
|
||||||
- [ ] Timers
|
- [x] Timers - TODO: Adding in sound notifications.
|
||||||
- [ ] Todos
|
- [ ] Todos
|
||||||
- [ ] Weather
|
- [ ] Weather
|
||||||
- [ ] Wolfram
|
- [ ] Wolfram
|
||||||
@ -28,8 +28,15 @@
|
|||||||
- Cons of backend is large file transfers between devices, lots of internet usage
|
- 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
|
- Perks of frontend is less data transfer between devices requiring less internet usage
|
||||||
- Cons of frontend is slower generation
|
- 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
|
## Ideas
|
||||||
|
|
||||||
* Dashboard with api call counts
|
* Dashboard with api call counts
|
@ -32,6 +32,9 @@
|
|||||||
from transformers import pipeline
|
from transformers import pipeline
|
||||||
import spacy
|
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."
|
# 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)
|
# doc = nlp(text)
|
||||||
@ -64,18 +67,50 @@ class NLP:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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('==')
|
||||||
print(nlp.get_skill("one day I will see the world"))
|
print(nlp.get_skill("one day I will see the world"))
|
||||||
|
print(f"Took: {time.time()-starttime}")
|
||||||
|
starttime = time.time()
|
||||||
print("yay!")
|
print("yay!")
|
||||||
print(nlp.get_skill("What is the weather today?"))
|
print(nlp.get_skill("What is the weather today?"))
|
||||||
|
print(f"Took: {time.time()-starttime}")
|
||||||
|
starttime = time.time()
|
||||||
print('==')
|
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('====')
|
||||||
print(nlp.get_named_entities("one day I will see the world"))
|
print(nlp.get_named_entities("one day I will see the world"))
|
||||||
|
print(f"Took: {time.time()-starttime}")
|
||||||
|
starttime = time.time()
|
||||||
print("yay!")
|
print("yay!")
|
||||||
print(nlp.get_named_entities("What is the weather today in london?"))
|
print(nlp.get_named_entities("What is the weather today in london?"))
|
||||||
|
print(f"Took: {time.time()-starttime}")
|
||||||
|
starttime = time.time()
|
||||||
print('====')
|
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"
|
# sequence_to_classify = "one day I will see the world"
|
||||||
# candidate_labels = ['travel', 'cooking', 'dancing']
|
# candidate_labels = ['travel', 'cooking', 'dancing']
|
||||||
# print(classifier(sequence_to_classify, candidate_labels))
|
# print(classifier(sequence_to_classify, candidate_labels))
|
||||||
|
@ -84,7 +84,8 @@ class Timers:
|
|||||||
|
|
||||||
self._remove_timer(name)
|
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
|
return schedule.CancelJob
|
||||||
|
|
||||||
def get_remaining_time(self, name=""): #TODO: test this function
|
def get_remaining_time(self, name=""): #TODO: test this function
|
||||||
@ -110,6 +111,6 @@ class Timers:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dur = Timers()
|
dur = Timers()
|
||||||
dur.run("add", "2 minutes", "test timer")
|
dur.run("add", "15 seconds", "test timer")
|
||||||
# dur._add_timer(123, "123")
|
# dur._add_timer(123, "123")
|
||||||
# dur._trigger_timer("123")
|
# dur._trigger_timer("123")
|
@ -24,4 +24,7 @@ while True:
|
|||||||
time.sleep(0.1)
|
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…
Reference in New Issue
Block a user