Omnibus commited on
Commit
01f064c
·
verified ·
1 Parent(s): a716d77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -10
app.py CHANGED
@@ -34,22 +34,47 @@ def make_tree(url1="",url2="",url3="",url4=""):
34
  return gr.update(choices=[l for l in link_box],interactive=True)
35
  else:
36
  return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  def run():
38
  out=make_tree()
39
- return out
 
 
 
40
 
41
  with gr.Blocks() as app:
42
- with gr.Row():
43
- drop1=gr.Dropdown()
44
- drop2=gr.Dropdown()
45
- drop3=gr.Dropdown()
46
- drop4=gr.Dropdown()
47
- load_btn=gr.Button("Load JSON")
48
- links=gr.JSON()
49
- html_=gr.HTML()
 
 
 
 
 
 
 
50
  load_btn.click(load_json,[drop1,drop2,drop3,drop4],links)
51
  drop1.change(make_tree,drop1,[drop2])
52
  drop2.change(make_tree,[drop1,drop2],[drop3])
53
  drop3.change(make_tree,[drop1,drop2,drop3],[drop4])
54
- app.load(run,None,[drop1])
 
55
  app.launch()
 
34
  return gr.update(choices=[l for l in link_box],interactive=True)
35
  else:
36
  return None
37
+
38
+ def get_images():
39
+ html_out="<div>"
40
+ get_url=f'{main_directory}images/'
41
+
42
+ feed1 = requests.get(get_url)
43
+ spl = feed1.text.split("href=")
44
+ for line in spl:
45
+ spl2 = line.split(">")[0]
46
+ print(spl2)
47
+ html_out+=f'<div><img src={get_url}{spl2}></div>'
48
+ html_out+="</div>"
49
+ return html_out
50
+
51
  def run():
52
  out=make_tree()
53
+ im_html=get_images()
54
+ return out, im_html
55
+
56
+
57
 
58
  with gr.Blocks() as app:
59
+ with gr.Tab("Images"):
60
+ html_im=gr.HTML()
61
+ with gr.Tab("Raw"):
62
+ with gr.Row():
63
+ drop1=gr.Dropdown()
64
+ drop2=gr.Dropdown()
65
+ drop3=gr.Dropdown()
66
+ drop4=gr.Dropdown()
67
+ load_btn=gr.Button("Load JSON")
68
+ links=gr.JSON()
69
+
70
+ ###### Images ##########
71
+
72
+
73
+ ####### Raw ############
74
  load_btn.click(load_json,[drop1,drop2,drop3,drop4],links)
75
  drop1.change(make_tree,drop1,[drop2])
76
  drop2.change(make_tree,[drop1,drop2],[drop3])
77
  drop3.change(make_tree,[drop1,drop2,drop3],[drop4])
78
+ ######################
79
+ app.load(run,None,[drop1,html_im])
80
  app.launch()