Spaces:
Runtime error
Runtime error
go2sujeet
commited on
Commit
·
3436e25
1
Parent(s):
d687dbc
- src/main.py +16 -0
src/main.py
CHANGED
@@ -2,6 +2,8 @@ from datetime import datetime
|
|
2 |
import json
|
3 |
from data_classes import Event, TimeWindow
|
4 |
from utils import filter_event_by_date_facility_id, find_max_continuous_sequence, loadDataFromJson, twenty_four_hours_bucket_time_series_by_minute
|
|
|
|
|
5 |
|
6 |
def find_most_occupied_window(target_date:datetime, target_facility_id:int):
|
7 |
data = loadDataFromJson()
|
@@ -21,3 +23,17 @@ result = find_most_occupied_window(target_date, target_facility_id)
|
|
21 |
print("Most number of slots at the same time is {}".format(result[1]))
|
22 |
#problem 2
|
23 |
print("Most occupied window is between {} and {} with {} occupied spots".format(result[0][0],result[0][1],result[1]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import json
|
3 |
from data_classes import Event, TimeWindow
|
4 |
from utils import filter_event_by_date_facility_id, find_max_continuous_sequence, loadDataFromJson, twenty_four_hours_bucket_time_series_by_minute
|
5 |
+
import gradio as gr
|
6 |
+
from gradio_calendar import Calendar
|
7 |
|
8 |
def find_most_occupied_window(target_date:datetime, target_facility_id:int):
|
9 |
data = loadDataFromJson()
|
|
|
23 |
print("Most number of slots at the same time is {}".format(result[1]))
|
24 |
#problem 2
|
25 |
print("Most occupied window is between {} and {} with {} occupied spots".format(result[0][0],result[0][1],result[1]))
|
26 |
+
|
27 |
+
def greet(name):
|
28 |
+
return "Hello " + name + "!"
|
29 |
+
|
30 |
+
with gr.Blocks() as app:
|
31 |
+
with gr.Group():
|
32 |
+
target_date = Calendar(label="Target Date", default_value=datetime.now())
|
33 |
+
target_facility_id = gr.Number(label="Facility ID")
|
34 |
+
btn_1 = gr.Button(value="Find Most Occupied Window")
|
35 |
+
output1 = gr.Text(label="Most Occupied Window",show_copy_button = True)
|
36 |
+
btn_1.click(find_most_occupied_window, [target_date, target_facility_id])
|
37 |
+
|
38 |
+
if __name__ == "__main__":
|
39 |
+
app.launch()
|