Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
import base64
|
| 4 |
|
| 5 |
def generate_html(name, code):
|
| 6 |
try:
|
|
@@ -13,9 +12,7 @@ def generate_html(name, code):
|
|
| 13 |
def download_file(name):
|
| 14 |
try:
|
| 15 |
with open(f"{name}.html", "rb") as f:
|
| 16 |
-
|
| 17 |
-
encoded_data = base64.b64encode(bytes_data).decode("utf-8")
|
| 18 |
-
return {"name": f"{name}.html", "data": encoded_data}
|
| 19 |
except Exception as e:
|
| 20 |
return None
|
| 21 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
|
|
|
| 3 |
|
| 4 |
def generate_html(name, code):
|
| 5 |
try:
|
|
|
|
| 12 |
def download_file(name):
|
| 13 |
try:
|
| 14 |
with open(f"{name}.html", "rb") as f:
|
| 15 |
+
return f.read()
|
|
|
|
|
|
|
| 16 |
except Exception as e:
|
| 17 |
return None
|
| 18 |
|