Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -98,7 +98,6 @@ def _create_zip(file_dict: dict) -> str:
|
|
| 98 |
|
| 99 |
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zipf:
|
| 100 |
for rel_path, content in file_dict.items():
|
| 101 |
-
# Ensure parent directories exist inside the zip
|
| 102 |
zipf.writestr(rel_path, content)
|
| 103 |
|
| 104 |
return str(zip_path)
|
|
@@ -153,7 +152,7 @@ def generate_web_code(idea: str, language: str):
|
|
| 153 |
elif current_file:
|
| 154 |
sections[current_file] += line + "\n"
|
| 155 |
|
| 156 |
-
#
|
| 157 |
preview_key = None
|
| 158 |
for key in sections:
|
| 159 |
if key.lower().endswith((".html", ".py", ".js")):
|
|
@@ -229,7 +228,7 @@ with gr.Blocks() as demo:
|
|
| 229 |
)
|
| 230 |
download_btn = gr.File(
|
| 231 |
label="Download Project Zip",
|
| 232 |
-
type="
|
| 233 |
visible=False,
|
| 234 |
)
|
| 235 |
generate_btn = gr.Button("Generate")
|
|
|
|
| 98 |
|
| 99 |
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zipf:
|
| 100 |
for rel_path, content in file_dict.items():
|
|
|
|
| 101 |
zipf.writestr(rel_path, content)
|
| 102 |
|
| 103 |
return str(zip_path)
|
|
|
|
| 152 |
elif current_file:
|
| 153 |
sections[current_file] += line + "\n"
|
| 154 |
|
| 155 |
+
# Determine a preview file (HTML, Python or JS if present)
|
| 156 |
preview_key = None
|
| 157 |
for key in sections:
|
| 158 |
if key.lower().endswith((".html", ".py", ".js")):
|
|
|
|
| 228 |
)
|
| 229 |
download_btn = gr.File(
|
| 230 |
label="Download Project Zip",
|
| 231 |
+
type="filepath",
|
| 232 |
visible=False,
|
| 233 |
)
|
| 234 |
generate_btn = gr.Button("Generate")
|