Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,25 +27,53 @@ def string_rep(pq):
|
|
| 27 |
|
| 28 |
return work
|
| 29 |
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
cur_date = datetime.strptime(date_str, date_format)
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
return string_rep(pq)
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
return string_rep(pq)
|
| 43 |
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
datebox = gr.Textbox(label="Enter your date here:", placeholder="MM-DD-YYYY at HH:MM")
|
| 46 |
|
| 47 |
hwbox = gr.Textbox(label="Enter your assignment name here:", placeholder="Homework")
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
ouputbox = gr.Textbox(label="List of Assignments:", placeholder="Homework is due on MM-DD-YYYY at HH:MM", lines = 10)
|
| 50 |
|
| 51 |
def tester(str1, str2):
|
|
@@ -55,8 +83,8 @@ def tester(str1, str2):
|
|
| 55 |
return str(cur_date.month)
|
| 56 |
|
| 57 |
iface = gr.Interface(
|
| 58 |
-
fn=
|
| 59 |
-
inputs=[datebox, hwbox],
|
| 60 |
outputs=ouputbox,
|
| 61 |
title="Homework Prioritzer",
|
| 62 |
description="Add Work",
|
|
|
|
| 27 |
|
| 28 |
return work
|
| 29 |
|
| 30 |
+
|
| 31 |
+
def inputter(date_str, item_name, add):
|
| 32 |
|
| 33 |
cur_date = datetime.strptime(date_str, date_format)
|
| 34 |
|
| 35 |
+
if add == "Add":
|
| 36 |
+
|
| 37 |
+
pq.put((cur_date, item_name))
|
| 38 |
|
|
|
|
| 39 |
|
| 40 |
+
else:
|
| 41 |
|
| 42 |
+
remove((cur_date,item_name))
|
| 43 |
|
| 44 |
return string_rep(pq)
|
| 45 |
|
| 46 |
|
| 47 |
+
def remove(element):
|
| 48 |
+
|
| 49 |
+
temp = PriorityQueue()
|
| 50 |
+
|
| 51 |
+
while not pq.empty():
|
| 52 |
+
|
| 53 |
+
elem = pq.get()
|
| 54 |
+
if elem == element:
|
| 55 |
+
|
| 56 |
+
break
|
| 57 |
+
|
| 58 |
+
else:
|
| 59 |
+
|
| 60 |
+
temp.put(elem)
|
| 61 |
+
|
| 62 |
+
while not pq.empty():
|
| 63 |
+
|
| 64 |
+
temp.put(pq.get())
|
| 65 |
+
|
| 66 |
+
pq = temp
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
datebox = gr.Textbox(label="Enter your date here:", placeholder="MM-DD-YYYY at HH:MM")
|
| 71 |
|
| 72 |
hwbox = gr.Textbox(label="Enter your assignment name here:", placeholder="Homework")
|
| 73 |
|
| 74 |
+
addbox = gr.Textbox(label="Add or Drop?:", placeholder="Add or Drop")
|
| 75 |
+
|
| 76 |
+
|
| 77 |
ouputbox = gr.Textbox(label="List of Assignments:", placeholder="Homework is due on MM-DD-YYYY at HH:MM", lines = 10)
|
| 78 |
|
| 79 |
def tester(str1, str2):
|
|
|
|
| 83 |
return str(cur_date.month)
|
| 84 |
|
| 85 |
iface = gr.Interface(
|
| 86 |
+
fn=inputter,
|
| 87 |
+
inputs=[datebox, hwbox, addbox],
|
| 88 |
outputs=ouputbox,
|
| 89 |
title="Homework Prioritzer",
|
| 90 |
description="Add Work",
|