Omnibus commited on
Commit
6880472
·
verified ·
1 Parent(s): e1b2d02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -100,6 +100,30 @@ def show_f(repo,name,token):
100
  gr.update(choices=[f for f in f_ist],interactive=True),
101
  api.get_space_runtime(f'{repo}/{name}'))
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  def move(repo,space,dest,token):
104
  from_id=f'{repo}/{space}'
105
  to_id=f'{dest}/{space}'
 
100
  gr.update(choices=[f for f in f_ist],interactive=True),
101
  api.get_space_runtime(f'{repo}/{name}'))
102
 
103
+ def show_f_cont(repo,name,file,token):
104
+ html_text = '<html>\n<body>\n<div>\n'
105
+ images=[".png" , ".jpg" , ".gif" , ".webm" , ".mp4"]
106
+ is_im=False
107
+ for x in images:
108
+ if x in file:
109
+ html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/resolve/main/{file}" style="width:100%;font-size:small;"></object>'
110
+ out_text = "Image File"
111
+ is_im=True
112
+ else:
113
+ pass
114
+ if is_im==False:
115
+ print(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}')
116
+ r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}')
117
+ text=r.text
118
+ html_text += f'<pre style="text-wrap:pretty;">{text}</pre>\n'
119
+ out_text = r.text
120
+ else:
121
+ pass
122
+ html_text += '</div>\n</body>\n</html>'
123
+ return(html_text)
124
+
125
+
126
+
127
  def move(repo,space,dest,token):
128
  from_id=f'{repo}/{space}'
129
  to_id=f'{dest}/{space}'