Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ import uuid
|
|
5 |
from PIL import Image
|
6 |
import gradio as gr
|
7 |
from pathlib import Path
|
|
|
|
|
8 |
from huggingface_hub import (create_repo,get_full_repo_name,upload_file,CommitOperationAdd,HfApi)
|
9 |
uid = uuid.uuid4()
|
10 |
|
@@ -155,6 +157,17 @@ def make_files(t_name,t_space,t_title,t_description,t_redirect,t_image=None,t_im
|
|
155 |
with open("back_gab.html", "w") as f:
|
156 |
f.write(app)
|
157 |
files.append("back_gab.html")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
return (files)
|
159 |
|
160 |
|
|
|
5 |
from PIL import Image
|
6 |
import gradio as gr
|
7 |
from pathlib import Path
|
8 |
+
from zipfile import ZipFile
|
9 |
+
|
10 |
from huggingface_hub import (create_repo,get_full_repo_name,upload_file,CommitOperationAdd,HfApi)
|
11 |
uid = uuid.uuid4()
|
12 |
|
|
|
157 |
with open("back_gab.html", "w") as f:
|
158 |
f.write(app)
|
159 |
files.append("back_gab.html")
|
160 |
+
|
161 |
+
|
162 |
+
if t_name == None or t_name =="":
|
163 |
+
t_name = t_iframe.split("www.", 1)[1].replace(".","_").replace("/", "-")
|
164 |
+
with ZipFile(f"{t_name}.zip", "w") as zipObj:
|
165 |
+
for idx, file in enumerate(files):
|
166 |
+
zipObj.write(f'{file}')
|
167 |
+
files.append(f'{t_name}.zip')
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
return (files)
|
172 |
|
173 |
|