Spaces:
Runtime error
Runtime error
first
Browse files- .gitignore +47 -0
- app.py +28 -0
.gitignore
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Python build
|
3 |
+
.eggs/
|
4 |
+
gradio.egg-info/*
|
5 |
+
!gradio.egg-info/requires.txt
|
6 |
+
!gradio.egg-info/PKG-INFO
|
7 |
+
dist/
|
8 |
+
*.pyc
|
9 |
+
__pycache__/
|
10 |
+
*.py[cod]
|
11 |
+
*$py.class
|
12 |
+
build/
|
13 |
+
|
14 |
+
# JS build
|
15 |
+
gradio/templates/frontend
|
16 |
+
# Secrets
|
17 |
+
.env
|
18 |
+
|
19 |
+
# Gradio run artifacts
|
20 |
+
*.db
|
21 |
+
*.sqlite3
|
22 |
+
gradio/launches.json
|
23 |
+
flagged/
|
24 |
+
# gradio_cached_examples/
|
25 |
+
|
26 |
+
# Tests
|
27 |
+
.coverage
|
28 |
+
coverage.xml
|
29 |
+
test.txt
|
30 |
+
|
31 |
+
# Demos
|
32 |
+
demo/tmp.zip
|
33 |
+
demo/files/*.avi
|
34 |
+
demo/files/*.mp4
|
35 |
+
|
36 |
+
# Etc
|
37 |
+
.idea/*
|
38 |
+
.DS_Store
|
39 |
+
*.bak
|
40 |
+
workspace.code-workspace
|
41 |
+
*.h5
|
42 |
+
.vscode/
|
43 |
+
|
44 |
+
# log files
|
45 |
+
.pnpm-debug.log
|
46 |
+
venv/
|
47 |
+
*.db-journal
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
block = gr.Blocks()
|
4 |
+
|
5 |
+
|
6 |
+
def predict(text, url_params):
|
7 |
+
print(url_params)
|
8 |
+
return ["Hello " + text + "!!", url_params]
|
9 |
+
|
10 |
+
|
11 |
+
get_window_url_params = """
|
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 |
+
with block:
|
20 |
+
url_params = gr.JSON({}, visible=True, label="URL Params")
|
21 |
+
text_input = gr.Text(label="Input")
|
22 |
+
text_output = gr.Text(label="Output")
|
23 |
+
|
24 |
+
btn = gr.Button("Run")
|
25 |
+
btn.click(fn=predict, inputs=[text_input, url_params],
|
26 |
+
outputs=[text_output, url_params], _js=get_window_url_params)
|
27 |
+
|
28 |
+
block.launch(debug=True)
|