-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
85 lines (57 loc) · 2.22 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from taipy.gui import Gui, notify
from vision.HTNImageDetection import imageDetection
from textGenerator import textGenerator
name = ""
pref = ""
image = ""
size = 0
desc = ""
items = {}
def getMeals(name, pref, size, image):
if image:
meals = str(textGenerator([name, size, imageDetection(image), pref]))
# TODO: Object Classification using YOLO Code goes here
# meals=[f'Hello {name}, here is few {pref} meals you can make for {size} people:','1. Contrary to popular belief:', 'Lorem Ipsum is not simply random text It has roots in a piece of classical Latin literature from 45 BC', '2. Contrary to popular belief:', 'Lorem Ipsum is not simply random text It has roots in a piece of classical Latin literature from 45 BC', '3. Contrary to popular belief:', 'Lorem Ipsum is not simply random text It has roots in a piece of classical Latin literature from 45 BC']
else:
meals = "No image provided!"
return meals
# class User:
# def getItems(image):
# items = {'apple':1} # 'item: # of items'
# # TODO: Object Classification using YOLO Code goes here
# return items
# def __init__(self, name, size, image):
# self.name = name
# self.size = size
# self.items = getItems(image)
# # TODO: Research and create prompt for ideal results
# prompt = open("prompt.txt", "r").read()
# # TODO: Plug in items available and their quantities
# # TODO: Send this prompt to BentoML
# ideas = "Hello" + name
# # ideas = BentoML(...)
# return ideas
page = """
Name: \n
<|{name}|input|>
Portion Size: <|{size}|>
<|{size}|slider|min=1|max=10|>
Preferences:
<|{pref}|input|>
Input a image of your fridge: <|{image}|>
<|{image}|file_selector|extensions=.png,.jpg,.jpeg,.heic|>
<|Submit|button|on_action=submit|>
<|{desc}|>
"""
def submit(state):
state.desc = getMeals(state.name, state.pref, state.size, state.image)
# state.d, state.h1, state.d1, state.h2, state.d2, state.h3, state.d3 = getMeals(state.name, state.pref, state.size, state.image)
if __name__ == "__main__":
gui = Gui(page=page)
gui.run(title="Fridge Guru")
# <|{h1}|>
# <|{d1}|>
# <|{h2}|>
# <|{d2}|>
# <|{h3}|>
# <|{d3}|>