bobbypaton commited on
Commit ·
e7afba3
1
Parent(s): ff85ac8
Fix iframe redirect for HF Spaces embedding
Browse files
app.py
CHANGED
|
@@ -166,7 +166,15 @@ def create_app():
|
|
| 166 |
@app.route("/")
|
| 167 |
@app.route("/cascade_v1")
|
| 168 |
def root():
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
# Allow HF Spaces to embed the app in an iframe
|
| 172 |
@app.after_request
|
|
|
|
| 166 |
@app.route("/")
|
| 167 |
@app.route("/cascade_v1")
|
| 168 |
def root():
|
| 169 |
+
# meta-refresh + JS redirect so HF iframe follows it
|
| 170 |
+
return '''<!DOCTYPE html>
|
| 171 |
+
<html>
|
| 172 |
+
<head>
|
| 173 |
+
<meta http-equiv="refresh" content="0; url=/cascade_v1/predict/">
|
| 174 |
+
<script>window.location.href="/cascade_v1/predict/";</script>
|
| 175 |
+
</head>
|
| 176 |
+
<body></body>
|
| 177 |
+
</html>'''
|
| 178 |
|
| 179 |
# Allow HF Spaces to embed the app in an iframe
|
| 180 |
@app.after_request
|