Spaces:
Sleeping
Sleeping
Correct restaurant name, and logout functionality
Browse files
app.py
CHANGED
@@ -27,7 +27,6 @@ config = {'possible_shifts': {'No shifts': 0}, 'possible_modes': ["waste"]}
|
|
27 |
|
28 |
|
29 |
def login(username, password) -> bool:
|
30 |
-
# TODO from username and password get restaurant_id
|
31 |
if os.path.isfile('credentials.csv'):
|
32 |
df = pd.read_csv('credentials.csv')
|
33 |
else:
|
@@ -92,11 +91,10 @@ def predict_app(image, patient_id):
|
|
92 |
|
93 |
with gr.Blocks(head=prefer_frontal_cam_html) as block:
|
94 |
with gr.Tab(label='Welcome'):
|
95 |
-
gr.Markdown(f'# User: {config.get("restaurant_name", "Proppos")}')
|
96 |
-
|
97 |
-
|
98 |
@gr.render()
|
99 |
def render_dropdowns():
|
|
|
|
|
100 |
shift_dropdown = gr.Dropdown(label='Meal/Comida/Apat',
|
101 |
value=list(config["possible_shifts"].items())[0],
|
102 |
choices=tuple(config["possible_shifts"].items()))
|
@@ -105,6 +103,7 @@ with gr.Blocks(head=prefer_frontal_cam_html) as block:
|
|
105 |
choices=config["possible_modes"])
|
106 |
start_button = gr.Button(value='START')
|
107 |
start_button.click(fn=start_app, inputs=[shift_dropdown, mode_dropdown])
|
|
|
108 |
|
109 |
with gr.Tab(label='π· Capture'):
|
110 |
# MAIN TAB TO PREDICT
|
@@ -142,5 +141,4 @@ with gr.Blocks(head=prefer_frontal_cam_html) as block:
|
|
142 |
with gr.Tab(label='π Documentation'):
|
143 |
gr.Markdown()
|
144 |
|
145 |
-
#block.launch(auth=("proppos", "Proppos2019"))
|
146 |
block.launch(show_api=False, auth=login)
|
|
|
27 |
|
28 |
|
29 |
def login(username, password) -> bool:
|
|
|
30 |
if os.path.isfile('credentials.csv'):
|
31 |
df = pd.read_csv('credentials.csv')
|
32 |
else:
|
|
|
91 |
|
92 |
with gr.Blocks(head=prefer_frontal_cam_html) as block:
|
93 |
with gr.Tab(label='Welcome'):
|
|
|
|
|
|
|
94 |
@gr.render()
|
95 |
def render_dropdowns():
|
96 |
+
gr.Markdown(f'# User: {config.get("restaurant_name", "Proppos")}')
|
97 |
+
|
98 |
shift_dropdown = gr.Dropdown(label='Meal/Comida/Apat',
|
99 |
value=list(config["possible_shifts"].items())[0],
|
100 |
choices=tuple(config["possible_shifts"].items()))
|
|
|
103 |
choices=config["possible_modes"])
|
104 |
start_button = gr.Button(value='START')
|
105 |
start_button.click(fn=start_app, inputs=[shift_dropdown, mode_dropdown])
|
106 |
+
gr.LogoutButton()
|
107 |
|
108 |
with gr.Tab(label='π· Capture'):
|
109 |
# MAIN TAB TO PREDICT
|
|
|
141 |
with gr.Tab(label='π Documentation'):
|
142 |
gr.Markdown()
|
143 |
|
|
|
144 |
block.launch(show_api=False, auth=login)
|