Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -267,24 +267,18 @@ def remove_code_block(text):
|
|
267 |
def history_render(history: History):
|
268 |
return gr.update(open=True), history
|
269 |
|
270 |
-
|
271 |
def send_to_sandbox(code):
|
272 |
encoded_html = base64.b64encode(code.encode('utf-8')).decode('utf-8')
|
273 |
data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
|
274 |
return f"""
|
275 |
-
<
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
scrolling="auto"
|
281 |
-
sandbox="allow-scripts allow-same-origin"
|
282 |
-
onload="this.style.height='800px';"
|
283 |
-
></iframe>
|
284 |
-
</div>
|
285 |
-
</div>
|
286 |
"""
|
287 |
|
|
|
288 |
theme = gr.themes.Soft()
|
289 |
|
290 |
def load_json_data():
|
|
|
267 |
def history_render(history: History):
|
268 |
return gr.update(open=True), history
|
269 |
|
|
|
270 |
def send_to_sandbox(code):
|
271 |
encoded_html = base64.b64encode(code.encode('utf-8')).decode('utf-8')
|
272 |
data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
|
273 |
return f"""
|
274 |
+
<iframe
|
275 |
+
src="{data_uri}"
|
276 |
+
style="width:100%; height:800px; border:none;"
|
277 |
+
frameborder="0"
|
278 |
+
></iframe>
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
"""
|
280 |
|
281 |
+
|
282 |
theme = gr.themes.Soft()
|
283 |
|
284 |
def load_json_data():
|