broadfield-dev commited on
Commit
baf0070
·
verified ·
1 Parent(s): 53fa5a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -65,6 +65,31 @@ def run():
65
  out=make_tree()
66
  im_html=get_images()
67
  return im_html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  with gr.Blocks() as app:
69
  #datetimestamp=gr.Textbox()
70
  #datestamp=gr.Textbox()
@@ -86,6 +111,10 @@ with gr.Blocks() as app:
86
  load_btn=gr.Button("Load")
87
  html_raw=gr.HTML()
88
  links=gr.JSON()
 
 
 
 
89
  drop1.change(make_tree,drop1,[drop2])
90
  drop2.change(make_tree,[drop1,drop2],[drop3])
91
  drop3.change(make_tree,[drop1,drop2,drop3],[drop4])
@@ -94,7 +123,6 @@ with gr.Blocks() as app:
94
  drop6.change(make_tree,[drop1,drop2,drop3,drop4,drop5,drop6],[drop7])
95
  drop7.change(make_tree,[drop1,drop2,drop3,drop4,drop5,drop6,drop7],[drop8])
96
 
97
- first_btn.click(run,None,[html_im])
98
  #app.load(make_tree,None,drop1)
99
  app.queue(default_concurrency_limit=10).launch()
100
 
 
65
  out=make_tree()
66
  im_html=get_images()
67
  return im_html
68
+
69
+
70
+ datestamp=["1","1","1"]
71
+ timestamp=["1","1","1"]
72
+ datetimestamp="1:1:1"
73
+ def get_time():
74
+ datetimestamp=str(datetime.datetime.now()).split(".")[0]
75
+ datestamp=datetimestamp.replace(" ","-").split("-")
76
+ timestamp=datestamp[3].split(":")
77
+
78
+ html_out=f"""<div style='font-size:xxx-large;'>Current: {datetimestamp} UTC</div>"""
79
+ year1=int(datestamp[0])
80
+ month1=int(datestamp[1])
81
+ day1=int(datestamp[2])
82
+ hour1=int(timestamp[0])
83
+ minute1=int(timestamp[1])
84
+ year2=int(datestamp[0])
85
+ month2=int(datestamp[1])
86
+ day2=int(datestamp[2])
87
+ hour2=int(timestamp[0])
88
+ minute2=int(timestamp[1])
89
+ return (gr.update(value=html_out),gr.update(value=year1),gr.update(value=month1),
90
+ gr.update(value=day1),gr.update(value=hour1),gr.update(value=minute1),
91
+ gr.update(value=year2),gr.update(value=month2),gr.update(value=day2),gr.update(value=hour2),gr.update(value=minute2))
92
+
93
  with gr.Blocks() as app:
94
  #datetimestamp=gr.Textbox()
95
  #datestamp=gr.Textbox()
 
111
  load_btn=gr.Button("Load")
112
  html_raw=gr.HTML()
113
  links=gr.JSON()
114
+
115
+ app.load(get_time,None,[time_html,year1,month1,day1,hour1,minute1,year2,month2,day2,hour2,minute2]).then(make_tree,None,drop1)
116
+ load_btn.click(load_json,[drop1,drop2,drop3,drop4,drop5,drop6,drop7,drop8],[html_raw,links])
117
+
118
  drop1.change(make_tree,drop1,[drop2])
119
  drop2.change(make_tree,[drop1,drop2],[drop3])
120
  drop3.change(make_tree,[drop1,drop2,drop3],[drop4])
 
123
  drop6.change(make_tree,[drop1,drop2,drop3,drop4,drop5,drop6],[drop7])
124
  drop7.change(make_tree,[drop1,drop2,drop3,drop4,drop5,drop6,drop7],[drop8])
125
 
 
126
  #app.load(make_tree,None,drop1)
127
  app.queue(default_concurrency_limit=10).launch()
128