Omnibus commited on
Commit
1b594bb
1 Parent(s): 8eaf67d

Update dl.py

Browse files
Files changed (1) hide show
  1. dl.py +10 -11
dl.py CHANGED
@@ -158,8 +158,10 @@ def show_f_cont(repo,name,file,token):
158
  html_text += '</div>\n</body>\n</html>'
159
  return(html_text)
160
 
161
-
162
-
 
 
163
  def show_all(author,token):
164
  spaces=[]
165
  api = HfApi(token=token)
@@ -338,14 +340,11 @@ with gr.Blocks(css=css) as build:
338
  with gr.Row():
339
  l_btn = gr.Button("Load Space")
340
  with gr.Row():
341
- show_all_btn1 = gr.Button("Load All 1")
342
- show_all_btn2 = gr.Button("Load All 2")
343
- with gr.Box():
344
- r_h=gr.HTML()
345
- with gr.Row():
346
- r_t=gr.Textbox(max_lines=100)
347
- m_t=gr.Textbox(max_lines=100)
348
  uu=gr.Textbox(visible=False)
 
 
349
  with gr.Tab("View 3"):
350
  with gr.Row():
351
  with gr.Column(scale=1):
@@ -380,11 +379,11 @@ with gr.Blocks(css=css) as build:
380
 
381
  s_btn.click(show_s,[r_name,token],[s_name,space_radio,space_check])
382
  l_btn.click(show_f,[r_name,s_name,token], [f_name, files,file_radio])
383
- f_name.change(show_f_cont,[r_name,s_name,f_name],[r_h])
384
 
385
  #s_name.change(show_f,[r_name,s_name,token],[d_app,files])
386
  space_radio.change(show_f,[r_name,space_radio,token],[f_name, files,file_radio,space_info_json])
387
- file_radio.change(show_f_cont,[r_name,space_radio,file_radio,token],[file_contents])
388
 
389
  pass_btn.click(checkp,pass_box,[no,yes])
390
  #inbut.click(build_space,[token,t_name,s_type,m_type,r_type,d_app,d_css],output_html)
 
158
  html_text += '</div>\n</body>\n</html>'
159
  return(html_text)
160
 
161
+ def show_f_frame(repo,name,file,token):
162
+ file_url=f'https://huggingface.co/spaces/{repo}/{name}/blob/main/{file}'
163
+ out=f"""<div><iframe src='{file_url}' height='1200px' width='100%'></iframe>"""
164
+ return out
165
  def show_all(author,token):
166
  spaces=[]
167
  api = HfApi(token=token)
 
340
  with gr.Row():
341
  l_btn = gr.Button("Load Space")
342
  with gr.Row():
343
+ show_all_btn1 = gr.Button("Load All 1",visible=False)
344
+ show_all_btn2 = gr.Button("Load All 2",visible=False)
 
 
 
 
 
345
  uu=gr.Textbox(visible=False)
346
+ file_frame=gr.HTML()
347
+
348
  with gr.Tab("View 3"):
349
  with gr.Row():
350
  with gr.Column(scale=1):
 
379
 
380
  s_btn.click(show_s,[r_name,token],[s_name,space_radio,space_check])
381
  l_btn.click(show_f,[r_name,s_name,token], [f_name, files,file_radio])
382
+ f_name.change(show_f_cont,[r_name,s_name,f_name],[file_frame])
383
 
384
  #s_name.change(show_f,[r_name,s_name,token],[d_app,files])
385
  space_radio.change(show_f,[r_name,space_radio,token],[f_name, files,file_radio,space_info_json])
386
+ file_radio.change(show_f_frame,[r_name,space_radio,file_radio,token],[file_frame])
387
 
388
  pass_btn.click(checkp,pass_box,[no,yes])
389
  #inbut.click(build_space,[token,t_name,s_type,m_type,r_type,d_app,d_css],output_html)