Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
async () => {
|
| 5 |
|
| 6 |
const script = document.createElement("script");
|
|
@@ -8,7 +8,8 @@ async () => {
|
|
| 8 |
script.type="module";
|
| 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);
|
|
@@ -62,7 +63,7 @@ with gr.Blocks(css="style.css") as app:
|
|
| 62 |
url_params = gr.JSON({}, visible=True, label="")
|
| 63 |
|
| 64 |
|
| 65 |
-
app.load(fn=predict, inputs=[text_input,url_params], outputs=[text_output,markdown],_js=
|
| 66 |
go_btn.click(find_model,inp,out_html)
|
| 67 |
app.launch()
|
| 68 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
load_js1 = """
|
| 4 |
async () => {
|
| 5 |
|
| 6 |
const script = document.createElement("script");
|
|
|
|
| 8 |
script.type="module";
|
| 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 |
+
load_js2 = """
|
| 13 |
function(text_input, url_params) {
|
| 14 |
console.log(text_input, url_params);
|
| 15 |
const params = new URLSearchParams(window.location.search);
|
|
|
|
| 63 |
url_params = gr.JSON({}, visible=True, label="")
|
| 64 |
|
| 65 |
|
| 66 |
+
app.load(None,None,None,_js=load_js1).then(fn=predict, inputs=[text_input,url_params], outputs=[text_output,markdown],_js=load_js2)
|
| 67 |
go_btn.click(find_model,inp,out_html)
|
| 68 |
app.launch()
|
| 69 |
|