Omnibus commited on
Commit
3263bf0
·
verified ·
1 Parent(s): 36788d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -11,6 +11,13 @@ import urllib.request
11
  import uuid
12
  main_directory = "https://services.swpc.noaa.gov/"
13
 
 
 
 
 
 
 
 
14
  nasa_soho_gifs=[
15
  {"name":"EIT 304A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_304small.gif"},
16
  {"name":"EIT 195A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_195small.gif"},
@@ -42,6 +49,8 @@ css="""
42
  flex-direction: column;
43
  flex-flow: unset;
44
  flex-wrap: wrap;
 
 
45
  }
46
  .img_class{
47
  background: #ffffff;
@@ -112,7 +121,7 @@ def make_tree(url1="",url2="",url3="",url4=""):
112
  return None
113
 
114
  def get_images():
115
- html_out=f"<style>{css}</style><div class='img_box'>"
116
  get_url=f'{main_directory}images/geospace/'
117
  feed1 = requests.get(get_url)
118
  spl = feed1.text.split("href=")
@@ -180,7 +189,7 @@ def make_html(inp_files):
180
  html_out+='</div>'
181
  return html_out
182
 
183
- def make_nasa_soho():
184
  html_out=f"<style>{css}</style><div class='img_box_soho'>"
185
  for ea in nasa_soho_mp4:
186
  file_name=ea['source']
@@ -192,6 +201,16 @@ def make_nasa_soho():
192
  #html_out+=f'<div class="img_class_soho"><img src="file={file_name}"></div>'
193
  html_out+='</div>'
194
  return html_out
 
 
 
 
 
 
 
 
 
 
195
 
196
  def run():
197
  out=make_tree()
@@ -221,7 +240,7 @@ with gr.Blocks() as app:
221
  html_nasa=gr.HTML()
222
 
223
  ###### NASA Images ##########
224
- soho_btn.click(make_nasa_soho,None,html_nasa)
225
  ###### NOAA Images ##########
226
  load_btn.click(load_json,[drop1,drop2,drop3,drop4],[html_raw,links])
227
  anim_btn.click(make_animation,None,[file_out]).then(make_html,file_out,anim_out)
 
11
  import uuid
12
  main_directory = "https://services.swpc.noaa.gov/"
13
 
14
+ nasa_images=[
15
+ {"name":"EIT 171A", "source":"https://soho.nascom.nasa.gov/data/realtime/eit_171/512/latest.jpg"},
16
+ {"name":"EIT 195A", "source":"https://soho.nascom.nasa.gov/data/realtime/eit_195/512/latest.jpg"},
17
+ {"name":"EIT 284A", "source":"https://soho.nascom.nasa.gov/data/realtime/eit_284/512/latest.jpg"},
18
+ {"name":"EIT 304A", "source":"https://soho.nascom.nasa.gov/data/realtime/eit_304/512/latest.jpg"},
19
+ ]
20
+
21
  nasa_soho_gifs=[
22
  {"name":"EIT 304A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_304small.gif"},
23
  {"name":"EIT 195A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_195small.gif"},
 
49
  flex-direction: column;
50
  flex-flow: unset;
51
  flex-wrap: wrap;
52
+ justify-content: space-around;
53
+
54
  }
55
  .img_class{
56
  background: #ffffff;
 
121
  return None
122
 
123
  def get_images():
124
+ html_out=f"<style>{css}</style><div class='img_box'>"
125
  get_url=f'{main_directory}images/geospace/'
126
  feed1 = requests.get(get_url)
127
  spl = feed1.text.split("href=")
 
189
  html_out+='</div>'
190
  return html_out
191
 
192
+ def make_nasa_soho_videos():
193
  html_out=f"<style>{css}</style><div class='img_box_soho'>"
194
  for ea in nasa_soho_mp4:
195
  file_name=ea['source']
 
201
  #html_out+=f'<div class="img_class_soho"><img src="file={file_name}"></div>'
202
  html_out+='</div>'
203
  return html_out
204
+
205
+ def make_nasa_soho_images():
206
+ html_out=f"<style>{css}</style><div class='img_box_soho'>"
207
+ for ea in nasa_images:
208
+ file_name=ea['source']
209
+ html_out+=f'<div class="img_class_soho"><img src="file={file_name}"></div>'
210
+ html_out+='</div>'
211
+ html_in = make_nasa_soho_videos()
212
+ html_out+=html_in
213
+ return html_out
214
 
215
  def run():
216
  out=make_tree()
 
240
  html_nasa=gr.HTML()
241
 
242
  ###### NASA Images ##########
243
+ soho_btn.click(make_nasa_soho_images,None,html_nasa)
244
  ###### NOAA Images ##########
245
  load_btn.click(load_json,[drop1,drop2,drop3,drop4],[html_raw,links])
246
  anim_btn.click(make_animation,None,[file_out]).then(make_html,file_out,anim_out)