Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,17 @@ import urllib.request
|
|
11 |
import uuid
|
12 |
main_directory = "https://services.swpc.noaa.gov/"
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
html = """
|
15 |
<div>
|
16 |
PAGE_LINK
|
@@ -147,6 +158,14 @@ def make_html(inp_files):
|
|
147 |
html_out+='</div>'
|
148 |
return html_out
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
def run():
|
151 |
out=make_tree()
|
152 |
im_html=get_images()
|
@@ -170,13 +189,15 @@ with gr.Blocks() as app:
|
|
170 |
html_raw=gr.HTML()
|
171 |
links=gr.JSON()
|
172 |
with gr.Tab("NASA"):
|
173 |
-
|
|
|
|
|
174 |
|
175 |
-
###### Images ##########
|
176 |
-
|
|
|
177 |
load_btn.click(load_json,[drop1,drop2,drop3,drop4],[html_raw,links])
|
178 |
anim_btn.click(make_animation,None,[file_out]).then(make_html,file_out,anim_out)
|
179 |
-
|
180 |
####### Raw ############
|
181 |
drop1.change(make_tree,drop1,[drop2])
|
182 |
drop2.change(make_tree,[drop1,drop2],[drop3])
|
|
|
11 |
import uuid
|
12 |
main_directory = "https://services.swpc.noaa.gov/"
|
13 |
|
14 |
+
|
15 |
+
nasa_soho_images=[
|
16 |
+
{"name":"EIT 304A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_304small.gif"},
|
17 |
+
{"name":"EIT 195A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_195small.gif"},
|
18 |
+
{"name":"EIT 171A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_171small.gif"},
|
19 |
+
{"name":"EIT 284A", "source":"https://soho.nascom.nasa.gov/data/LATEST/current_eit_284small.gif"},
|
20 |
+
]
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
html = """
|
26 |
<div>
|
27 |
PAGE_LINK
|
|
|
158 |
html_out+='</div>'
|
159 |
return html_out
|
160 |
|
161 |
+
def make_nasa_soho():
|
162 |
+
html_out=f"<style>{css}</style><div class='img_box'>"
|
163 |
+
for ea in nasa_soho_images:
|
164 |
+
file_name=ea['source']
|
165 |
+
html_out+=f'<div class="img_class"><img src="file={file_name}"></div>'
|
166 |
+
html_out+='</div>'
|
167 |
+
return html_out
|
168 |
+
|
169 |
def run():
|
170 |
out=make_tree()
|
171 |
im_html=get_images()
|
|
|
189 |
html_raw=gr.HTML()
|
190 |
links=gr.JSON()
|
191 |
with gr.Tab("NASA"):
|
192 |
+
with gr.Tab("SOHO Current"):
|
193 |
+
soho_btn=gr.Button("Load")
|
194 |
+
html_nasa=gr.HTML()
|
195 |
|
196 |
+
###### NASA Images ##########
|
197 |
+
soho_btn.click(make_nasa_soho,None,html_nasa)
|
198 |
+
###### NOAA Images ##########
|
199 |
load_btn.click(load_json,[drop1,drop2,drop3,drop4],[html_raw,links])
|
200 |
anim_btn.click(make_animation,None,[file_out]).then(make_html,file_out,anim_out)
|
|
|
201 |
####### Raw ############
|
202 |
drop1.change(make_tree,drop1,[drop2])
|
203 |
drop2.change(make_tree,[drop1,drop2],[drop3])
|