Spaces:
Runtime error
Runtime error
Commit
·
f599c40
1
Parent(s):
88ff9cc
try other js injection
Browse files
app.py
CHANGED
|
@@ -122,21 +122,22 @@ css = """
|
|
| 122 |
}
|
| 123 |
"""
|
| 124 |
|
| 125 |
-
js_func = """
|
| 126 |
-
function refresh() {
|
| 127 |
-
const url = new URL(window.location);
|
| 128 |
-
|
| 129 |
-
if (url.searchParams.get('__theme') !== 'light') {
|
| 130 |
-
url.searchParams.set('__theme', 'light');
|
| 131 |
-
window.location.href = url.href;
|
| 132 |
-
}
|
| 133 |
-
}
|
| 134 |
-
"""
|
| 135 |
-
|
| 136 |
|
| 137 |
# generated_prompt = ""
|
| 138 |
|
| 139 |
-
with gr.Blocks(css=css, theme=gr.themes.Soft()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
# gr.Markdown("# Draptic: from garment image to technical flat sketch")
|
| 141 |
with gr.Row():
|
| 142 |
with gr.Column(elem_id="col-input-image"):
|
|
|
|
| 122 |
}
|
| 123 |
"""
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
# generated_prompt = ""
|
| 127 |
|
| 128 |
+
with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
|
| 129 |
+
demo.load(
|
| 130 |
+
None,
|
| 131 |
+
None,
|
| 132 |
+
_js="""
|
| 133 |
+
() => {
|
| 134 |
+
const params = new URLSearchParams(window.location.search);
|
| 135 |
+
if (!params.has('__theme')) {
|
| 136 |
+
params.set('__theme', 'light');
|
| 137 |
+
window.location.search = params.toString();
|
| 138 |
+
}
|
| 139 |
+
}""",
|
| 140 |
+
)
|
| 141 |
# gr.Markdown("# Draptic: from garment image to technical flat sketch")
|
| 142 |
with gr.Row():
|
| 143 |
with gr.Column(elem_id="col-input-image"):
|