def show_capture(timestamp): path = stamp_file(timestamp) mac_say.say("Please type in the following details") return render_template('userinfo_page.html', stamp=timestamp, path=path, data=problem_list, data1=alergies_list)
def options(): mac_say.say("thank you") time.sleep(2) mac_say.say( "Now Please Click on one of the following food Option that you would like to eat next time" ) return render_template("options.html")
def saveChoice(name): today = datetime.today() name = name image = name + ".jpg" user = session['id'] addFood(name, image, user, today) mac_say.say("nice choice. i like" + name + "too") time.sleep(1) mac_say.say("Please click to end the session") return render_template("userfood.html", name=name, image=image)
def run(self): tasks = gettasks(self.category) if not tasks: return mac_say.say("у вас есть задачи на сегодня", background=True) for task in tasks: title = "TODO: %s" % task.name message = "" # image = task.image image = None growlnotify.notify(t=title, m=message, image=image)
def run(self): if "accepting" not in os.popen("pg_isready").read(): return tasks = self.tasks() if not tasks: return mac_say.say("у вас есть задачи на сегодня", background=True) for task in tasks: title = "TODO: %s" % task.name f = task.path message = open(f).read() if os.path.exists(f) else "" growlnotify.notify(t=title, m=message, i=f)
def menu_page(health): user = health.split('-') health = user[0] allergies = user[1] today = datetime.today() day = datetime.today().weekday() now = datetime.now() current_time = now.strftime("%H:%M:%S") timee = current_time.split(':') time = int(timee[0]) dayyy = type(day) menu = [] #print(time) #menu= menu_24_breakfast[4] print("Current Time =", time) print("Today's day:", day) #if day == 1 and time<2: if day == 0 and (time > 8 and time < 12): menu = menu_13_breakfast elif day == 1 and (time > 8 and time < 12): menu = menu_24_breakfast elif (day == 2 or day == 5) and (time > 8 and time < 12): menu = menu_13_breakfast elif (day == 3 or day == 4) and (time > 8 and time < 12): menu = menu_24_breakfast elif (day == 0 or day == 4) and (time > 12 and time < 18): menu = menu_24_dinner elif day == 1 and (time > 12 and time < 18): menu = menu_2_lunch elif (day == 2 or day == 5) and (time > 12 and time < 18): menu = menu_3_lunch elif day == 3 and (time > 12 and time < 18): menu = menu_13_dinner elif (day == 0 or day == 4) and (time > 18 and time < 23): menu = menu_24_dinner elif (day == 2 or day == 5) and (time > 18 and time < 23): menu = menu_13_dinner elif (day == 3 or day == 1) and (time > 18 and time < 23): menu = menu_24_dinner else: menu = menu_13_dinner mac_say.say( "let’s talk about your todays meal. I see that you had the following menu today, you will need to select one to check the nutritions" ) return render_template("menu_page.html", health=health, allergies=allergies, menu=menu)
def suggestions_page(health): h = health.split('-') health_id = h[0] allergy = h[1] item = h[2] fg = h[3] food_id = h[4] url_goodfor = 'https://api.nutridigm.com/api/v1/nutridigm/goodfor?subscriptionId=123&itemID=' + item + '&problemId=' + str( health_id) url_topitemstoconsume = 'https://api.nutridigm.com/api/v1/nutridigm/topitemstoconsume?subscriptionId=123&problemId=' + str( health_id) url_thingstoavoid = 'https://api.nutridigm.com/api/v1/nutridigm/topitemstoavoid?subscriptionId=123&problemId=' + str( health_id) url_suggest = 'https://api.nutridigm.com/api/v1/nutridigm/suggest?subscriptionId=123&problemId=' + str( health_id) + '&fg2=' + str(fg) resp = requests.get(url_goodfor) resp_top = requests.get(url_topitemstoconsume) resp_avoid = requests.get(url_thingstoavoid) resp_suggest = requests.get(url_suggest) json_data = resp.json() json_top = resp_top.json() json_avoid = resp_avoid.json() json_suggest = resp_suggest.json() notes = json_data['notes'] print(json_data) data = { #'goodfor_data': resp.json(), 'topitemstoconsume_data': resp_top.json(), 'thingstoavoid_data': resp_avoid.json(), #'suggestions_data' : resp_suggest.json() } if resp.status_code != 200: # This means something went wrong. raise ApiError('GET /tasks/ {}'.format(resp.status_code)) #mac_say.say("You see that your selected item has 10 calories while it does not have any carbs, fat or proteins") mac_say.say( "You see that your selected item has 170 calories while it has 20 grams of carbs, 4 grams of fat and 14 grams of proteins" ) time.sleep(1) mac_say.say("Please click on the button to get some of my suggestions") return render_template("suggestions_page.html", data=data)
def main(): # main function to work and reply on keywords user_input = input("Type: ".lower()) user_words = user_input.split() for word in user_words: if word in hi: # response on keyword time mac_say.say("Hello") print("Hello") return main() elif word in time: # response on keywords hi strTime = datetime.datetime.now().strftime("%H:%M") print(f"The time is {strTime}") mac_say.say(f"The Time is {strTime}") return main()
def nutritions_page(health): h = health.split('-') health_id = h[0] allergy = h[1] item = h[2] fg = h[3] food_id = h[4] nut = fs.food_get(food_id) serve = nut['servings'] serve = serve['serving'] data = {} if len(serve) > 1: data = { 'calories': serve['calories'], 'carbohydrates': serve['carbohydrate'], 'fat': serve['fat'], 'protein': serve['protein'] } else: data = { 'calories': serve['calories'], 'carbohydrates': serve['carbohydrate'], 'fat': serve['fat'], 'fiber': serve['fiber'], 'protein': serve['protein'] } mac_say.say("Oh, nice. I like soups too") time.sleep(1) #mac_say.say("Remember you had turkey breast with corn salad last time when we interacted.") #mac_say.say("Remember you had vegetable soup last time when we interacted.") time.sleep(3) mac_say.say("Lets have a look at its nutrition value now") return render_template("nutritions_page.html", serve=data, health=health)
def end_page(): mac_say.say( "I really appreciate your time, Please fill the survey at the end of this session too" ) time.sleep(1) mac_say.say("I Hope to see you again") mac_say.say("bye bye") return render_template("end_page.html")
def wishme(): # WISHME FUNCTION which wishes according to time if hour >= 0 and hour < 12: mac_say.say("Good Morning!") print('Good Morning!') elif hour >= 12 and hour < 18: mac_say.say("Good Afternoon!") print("Good Afternoon!") else: mac_say.say("Good evening!") print("Good Evening!")
def speak_num_curbside_slots(self): if self.speak and platform == 'darwin': import mac_say if self.num_curbside_slots > 0: if self.detail or self.store_id: try: if self.num_curbside_slots == 1: mac_say.say("One curbside slot found") else: mac_say.say("{} curbside slots found".format(self.num_curbside_slots)) except Exception as e: print(e) else: try: if self.num_curbside_slots == 1: mac_say.say("One store with curbside slots found") else: mac_say.say("{} stores with curbside slots found".format(self.num_curbside_slots)) except Exception as e: print(e)
def add_user(): if request.method == 'POST': result = request.form name = result['name'] age = result['age'] allergies = result['allergies'] health = result['health'] image = result['image'] insertUser(name, age, allergies, health, image) mac_say.say("lovely. I feel like I’m your friend now. Let’s get started") time.sleep(2) #t = Thread(target=myfunc, args = (text,)) #t.start() mac_say.say("Hello " + name + "I hope you are doing well today") time.sleep(3) mac_say.say("Please select one of the following options") return render_template('page1.html', name=name, health=health, allergies=allergies)
def say(self): mac_say.say("Сейчас %s" % self.text)
#!/usr/bin/env python import mac_say args = ["hello world"] mac_say.say(args) mac_say.say(args, background=True)
#!/usr/bin/env python import mac_say mac_say.say("hello world") mac_say.say(args, background=True)
def say(self, args, background=False): return mac_say.say(args, background=background)
def say(self): say = "Температура в квартире - %s градусов" % self.t mac_say.say(say)
def speak(text): mac_say.say(text, background=True)
def start(): mac_say.say("Good Afternoon. Please click on start button to continue") return render_template("start.html")
def say(s): mac_say.say(s)
def newuser(): time.sleep(1) camera = get_camera() stamp = camera.captureforaldreadyuser() stamp1 = "static/captures/test.jpg" flag, name = check_face_match(stamp, stamp1) rv = getUser(name) id = 0 for r in rv: name = r[0] health = r[1] allergies = r[2] id = r[3] if 'id' in session: session['id'] = id else: session['id'] = id if flag == True: mac_say.say("Hello" + name) time.sleep(1) mac_say.say("I have missed seeing you. How are you today?") time.sleep(2) mac_say.say("I hope you are having a wonderful day.") time.sleep(2) mac_say.say("Please select one of the following options") return render_template("page1.html", name=name, health=health, allergies=allergies) else: mac_say.say("I see that we are meeting first time") time.sleep(2) mac_say.say("Please click the button if you like to be my friend?") return render_template("newuser.html")
def response(): #mac_say.say("this soup is very healthy. It will be helpful to keep you fit.") mac_say.say( "You should try to consume Chicken noodle soup less.It will be helpful to keep you fit." ) time.sleep(1) mac_say.say( "Although, I suggest you to exercise more and eat Broccoli, Carrots, Potatoes, Spinach, Flaxseed, Nuts, Fish, Beans, Avocado, Persimmons and Berries" ) time.sleep(2) mac_say.say( "while i recommend you to avoid more than 2 alcoholic drinks in a day, Sweets and Refined sugar, Excess Weight, Animal fat & Hydrogenated Vegetable Oil, Processed Meats and strictly avoid Smoking;" ) time.sleep(1) mac_say.say("Do you think you can do this for yourself?") time.sleep(4) mac_say.say("great") time.sleep(1) mac_say.say( "Now, Please select your preference about today's meal after listening to my suggestions" ) return render_template("response.html")
def welcome(): # welcome function to welcome print("Hello!") mac_say.say("Hello!")
def camera_start(): mac_say.say("Please look at me first and smile") return render_template('camera.html')