go2sujeet commited on
Commit
682ed0f
·
1 Parent(s): 3436e25
Files changed (1) hide show
  1. src/main.py +7 -5
src/main.py CHANGED
@@ -24,16 +24,18 @@ 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()
 
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 process1(target_date, target_facility_id):
28
+ result = find_most_occupied_window(target_date, target_facility_id)
29
+ return "Most occupied window is between {} and {} with {} occupied spots".format(result[0][0],result[0][1],result[1])
30
 
31
  with gr.Blocks() as app:
32
  with gr.Group():
33
+ target_date = Calendar(label="Target Date",value=target_date)
34
+ target_facility_id = gr.Number(label="Facility ID", value=target_facility_id)
35
  btn_1 = gr.Button(value="Find Most Occupied Window")
36
  output1 = gr.Text(label="Most Occupied Window",show_copy_button = True)
37
+ btn_1.click(process1, [target_date, target_facility_id], outputs=output1)
38
+
39
 
40
  if __name__ == "__main__":
41
  app.launch()