Omnibus commited on
Commit
b41e05d
·
verified ·
1 Parent(s): aabcb49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -316,7 +316,7 @@ def get_concat_v_cut(in1, in2, theme='dark'):
316
 
317
 
318
 
319
- def nasa_sdo_composite(obj,size,date1,date2):
320
  html_in=f"<style>{css}</style><div class='img_box_soho'>"
321
  if int(date2[6:8])-int(date1[6:8]) >0:
322
  return ("<div style='font-size:xxx-large'>Reduce Timespan to 24 hours</div>")
@@ -337,7 +337,7 @@ def nasa_sdo_composite(obj,size,date1,date2):
337
  anchor_elements = soup.find_all('a')
338
  #anchor_elements.sort()
339
  cnt=1
340
- max_cnt=4
341
  for element in anchor_elements:
342
  href=element.get('href')
343
  if href.endswith('.jpg'):
@@ -393,12 +393,12 @@ def get_date(year1,month1,day1,hour1,minute1,year2,month2,day2,hour2,minute2):
393
  print(date1)
394
  print(date2)
395
  return date1,date2
396
- def comp_combine(inp_ims: list):
397
  #print(inp_ims)
398
  im_box=[]
399
  v_box=[]
400
- rows=2
401
- cols=2
402
  for i,im in enumerate(eval(inp_ims)):
403
  urllib.request.urlretrieve(im, f"tmp-{i}.jpg")
404
  im_box.append(f"tmp-{i}.jpg")
@@ -472,9 +472,9 @@ with gr.Blocks() as app:
472
 
473
  with gr.Tab("Composite"):
474
  with gr.Row():
475
- comp_num=gr.Number(label="Return",precision=0,value=4)
476
- comp_col=gr.Number(label="Columns",precision=0)
477
- comp_row=gr.Number(label="Rows",precision=0)
478
  with gr.Row():
479
  comp_combine_btn=gr.Button("Combine")
480
  sdo_comp_btn=gr.Button("Load")
@@ -498,8 +498,8 @@ with gr.Blocks() as app:
498
  html_vid_nasa=gr.HTML()
499
 
500
  ###### Composite Images ##########
501
- comp_combine_btn.click(comp_combine,image_comp_list,img_out)
502
- sdo_comp_btn.click(get_date,[year1,month1,day1,hour1,minute1,year2,month2,day2,hour2,minute2],[date1,date2]).then(nasa_sdo_composite,[sdo_drop1,sdo_drop2,date1,date2],[sdo_comp_html,image_comp_list])
503
 
504
  ###### NASA Images ##########
505
  sdo_btn.click(get_date,[year1,month1,day1,hour1,minute1,year2,month2,day2,hour2,minute2],[date1,date2]).then(nasa_sdo_images,[sdo_drop1,sdo_drop2,date1,date2],sdo_html)
 
316
 
317
 
318
 
319
+ def nasa_sdo_composite(obj,size,date1,date2,ret_num):
320
  html_in=f"<style>{css}</style><div class='img_box_soho'>"
321
  if int(date2[6:8])-int(date1[6:8]) >0:
322
  return ("<div style='font-size:xxx-large'>Reduce Timespan to 24 hours</div>")
 
337
  anchor_elements = soup.find_all('a')
338
  #anchor_elements.sort()
339
  cnt=1
340
+ max_cnt=ret_num
341
  for element in anchor_elements:
342
  href=element.get('href')
343
  if href.endswith('.jpg'):
 
393
  print(date1)
394
  print(date2)
395
  return date1,date2
396
+ def comp_combine(inp_ims: list,comp_col,comp_row):
397
  #print(inp_ims)
398
  im_box=[]
399
  v_box=[]
400
+ rows=comp_row
401
+ cols=comp_col
402
  for i,im in enumerate(eval(inp_ims)):
403
  urllib.request.urlretrieve(im, f"tmp-{i}.jpg")
404
  im_box.append(f"tmp-{i}.jpg")
 
472
 
473
  with gr.Tab("Composite"):
474
  with gr.Row():
475
+ comp_num=gr.Number(label="Return",precision=0,value=4,interactive=True)
476
+ comp_col=gr.Number(label="Columns",precision=0,value=2,interactive=True)
477
+ comp_row=gr.Number(label="Rows",precision=0,value=2,interactive=True)
478
  with gr.Row():
479
  comp_combine_btn=gr.Button("Combine")
480
  sdo_comp_btn=gr.Button("Load")
 
498
  html_vid_nasa=gr.HTML()
499
 
500
  ###### Composite Images ##########
501
+ comp_combine_btn.click(comp_combine,[image_comp_list,comp_col,comp_row],img_out)
502
+ sdo_comp_btn.click(get_date,[year1,month1,day1,hour1,minute1,year2,month2,day2,hour2,minute2],[date1,date2]).then(nasa_sdo_composite,[sdo_drop1,sdo_drop2,date1,date2,comp_num],[sdo_comp_html,image_comp_list])
503
 
504
  ###### NASA Images ##########
505
  sdo_btn.click(get_date,[year1,month1,day1,hour1,minute1,year2,month2,day2,hour2,minute2],[date1,date2]).then(nasa_sdo_images,[sdo_drop1,sdo_drop2,date1,date2],sdo_html)