Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,8 +9,22 @@ async () => {
|
|
| 9 |
script.src = "https://ajax.googleapis.com/ajax/libs/model-viewer/3.1.1/model-viewer.min.js";
|
| 10 |
document.head.appendChild(script)
|
| 11 |
}
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
def find_model(url):
|
| 15 |
try:
|
| 16 |
out = gr.HTML(f'''
|
|
@@ -39,7 +53,15 @@ with gr.Blocks(css="style.css") as app:
|
|
| 39 |
</div>
|
| 40 |
""")
|
| 41 |
'''
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
go_btn.click(find_model,inp,out_html)
|
| 44 |
app.launch()
|
| 45 |
|
|
|
|
| 9 |
script.src = "https://ajax.googleapis.com/ajax/libs/model-viewer/3.1.1/model-viewer.min.js";
|
| 10 |
document.head.appendChild(script)
|
| 11 |
}
|
| 12 |
+
function(text_input, url_params) {
|
| 13 |
+
console.log(text_input, url_params);
|
| 14 |
+
const params = new URLSearchParams(window.location.search);
|
| 15 |
+
url_params = Object.fromEntries(params);
|
| 16 |
+
return [text_input, url_params];
|
| 17 |
+
}
|
| 18 |
|
| 19 |
+
"""
|
| 20 |
+
def predict(text, url_params):
|
| 21 |
+
|
| 22 |
+
if url_params.get('123') =='sdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsd':
|
| 23 |
+
out = gr.HTML.update("""<h1 class="glow">Success</h1>""")
|
| 24 |
+
else:
|
| 25 |
+
out=gr.HTML.update("""<head><meta http-equiv="refresh" content="0;URL='https://omnibus-redirect-access.hf.space'"></head>""")
|
| 26 |
+
return ["" + text + "", out]
|
| 27 |
+
|
| 28 |
def find_model(url):
|
| 29 |
try:
|
| 30 |
out = gr.HTML(f'''
|
|
|
|
| 53 |
</div>
|
| 54 |
""")
|
| 55 |
'''
|
| 56 |
+
markdown = gr.HTML("""""")
|
| 57 |
+
|
| 58 |
+
with gr.Row(visible=False):
|
| 59 |
+
text_input=gr.Textbox()
|
| 60 |
+
text_output=gr.Textbox()
|
| 61 |
+
url_params = gr.JSON({}, visible=True, label="")
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
app.load(fn=predict, inputs=[text_input,url_params], outputs=[text_output,markdown],_js=load_js)
|
| 65 |
go_btn.click(find_model,inp,out_html)
|
| 66 |
app.launch()
|
| 67 |
|