Spaces:
Running
Running
Commit
•
2add774
1
Parent(s):
c9c2351
small changes
Browse files- app.py +4 -4
- online_demo/index.html +0 -92
- run.ipynb +73 -10
app.py
CHANGED
@@ -28,8 +28,8 @@ with gr.Blocks() as demo:
|
|
28 |
default_input_image = Image.open( os.path.join('online_demo', 'nerf_wild', 'step-100_scale-6.0', 'car1', 'input.png'))
|
29 |
input_image = gr.Image(default_input_image, shape=[256, 256])
|
30 |
options = sorted(os.listdir('online_demo/nerf_wild/step-100_scale-6.0'))
|
31 |
-
img_id = gr.Dropdown(options, value='car1')
|
32 |
-
text_button = gr.Button("
|
33 |
retrieve_input_image_dataset = partial(retrieve_input_image, 'nerf_wild')
|
34 |
text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)
|
35 |
|
@@ -51,7 +51,7 @@ with gr.Blocks() as demo:
|
|
51 |
default_input_image = Image.open( os.path.join('online_demo', 'GSO', 'step-100_scale-6.0', 'SAMBA_HEMP', 'input.png'))
|
52 |
input_image = gr.Image(default_input_image, shape=[256, 256])
|
53 |
options = sorted(os.listdir('online_demo/GSO/step-100_scale-6.0'))
|
54 |
-
img_id = gr.Dropdown(options, value='SAMBA_HEMP')
|
55 |
text_button = gr.Button("Choose Input Image")
|
56 |
retrieve_input_image_dataset = partial(retrieve_input_image, 'GSO')
|
57 |
text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)
|
@@ -74,7 +74,7 @@ with gr.Blocks() as demo:
|
|
74 |
default_input_image = Image.open( os.path.join('online_demo', 'RTMV', 'step-100_scale-6.0', '00000', 'input.png'))
|
75 |
input_image = gr.Image(default_input_image, shape=[256, 256])
|
76 |
options = sorted(os.listdir('online_demo/RTMV/step-100_scale-6.0'))
|
77 |
-
img_id = gr.Dropdown(options, value='00000')
|
78 |
text_button = gr.Button("Choose Input Image")
|
79 |
retrieve_input_image_dataset = partial(retrieve_input_image, 'RTMV')
|
80 |
text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)
|
|
|
28 |
default_input_image = Image.open( os.path.join('online_demo', 'nerf_wild', 'step-100_scale-6.0', 'car1', 'input.png'))
|
29 |
input_image = gr.Image(default_input_image, shape=[256, 256])
|
30 |
options = sorted(os.listdir('online_demo/nerf_wild/step-100_scale-6.0'))
|
31 |
+
img_id = gr.Dropdown(options, value='car1', label='options')
|
32 |
+
text_button = gr.Button("Load Input Image")
|
33 |
retrieve_input_image_dataset = partial(retrieve_input_image, 'nerf_wild')
|
34 |
text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)
|
35 |
|
|
|
51 |
default_input_image = Image.open( os.path.join('online_demo', 'GSO', 'step-100_scale-6.0', 'SAMBA_HEMP', 'input.png'))
|
52 |
input_image = gr.Image(default_input_image, shape=[256, 256])
|
53 |
options = sorted(os.listdir('online_demo/GSO/step-100_scale-6.0'))
|
54 |
+
img_id = gr.Dropdown(options, value='SAMBA_HEMP', label='options')
|
55 |
text_button = gr.Button("Choose Input Image")
|
56 |
retrieve_input_image_dataset = partial(retrieve_input_image, 'GSO')
|
57 |
text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)
|
|
|
74 |
default_input_image = Image.open( os.path.join('online_demo', 'RTMV', 'step-100_scale-6.0', '00000', 'input.png'))
|
75 |
input_image = gr.Image(default_input_image, shape=[256, 256])
|
76 |
options = sorted(os.listdir('online_demo/RTMV/step-100_scale-6.0'))
|
77 |
+
img_id = gr.Dropdown(options, value='00000', label='options')
|
78 |
text_button = gr.Button("Choose Input Image")
|
79 |
retrieve_input_image_dataset = partial(retrieve_input_image, 'RTMV')
|
80 |
text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)
|
online_demo/index.html
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<html>
|
2 |
-
<head>
|
3 |
-
<title>Zero-1-to-3</title>
|
4 |
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
5 |
-
<script>
|
6 |
-
|
7 |
-
var loc = window.location.pathname;
|
8 |
-
var path = loc.substring(0, loc.lastIndexOf('/')) + '/nerf_wild';
|
9 |
-
|
10 |
-
function ShowFolderFileList()
|
11 |
-
{
|
12 |
-
var fso, f, fc, s, temp;
|
13 |
-
fso = new ActiveXObject("Scripting.FileSystemObject");
|
14 |
-
f = fso.GetFolder(path);
|
15 |
-
fc = new Enumerator(f.files);
|
16 |
-
s = "";
|
17 |
-
temp = "";
|
18 |
-
for (; !fc.atEnd(); fc.moveNext())
|
19 |
-
{
|
20 |
-
temp = fc.item();
|
21 |
-
s = temp.name;
|
22 |
-
console.log(s)
|
23 |
-
document.getElementById('example').options[document.getElementById('example').options.length] = new Option (s, s);
|
24 |
-
};
|
25 |
-
}
|
26 |
-
|
27 |
-
function update() {
|
28 |
-
var polar = $("#polar").val();
|
29 |
-
var azimuth = $("#azimuth").val();
|
30 |
-
var zoom = $("#zoom").val();
|
31 |
-
var seed = $("#seed").val();
|
32 |
-
var img_id = $("#example").val();
|
33 |
-
var dataset = $("#dataset").val();
|
34 |
-
|
35 |
-
|
36 |
-
$("#novelim").attr('src', dataset + '/step-100_scale-6.0/' + img_id + '/polar-' + Math.round((parseInt(polar) + 30) / 30) + '_azimuth-' + Math.round(parseInt(azimuth) / 30) + '_distance-' + (parseInt(zoom) + 1) + '_seed-' + seed + '.png');
|
37 |
-
$("#originalim").attr('src', dataset + '/step-100_scale-6.0/' + img_id + '/input.png')
|
38 |
-
|
39 |
-
$("#polar-val").html(polar + "°");
|
40 |
-
$("#azimuth-val").html(azimuth + "°");
|
41 |
-
$("#zoom-val").html(zoom);
|
42 |
-
$("#seed-val").html(seed);
|
43 |
-
}
|
44 |
-
$(document).ready(function() {
|
45 |
-
$("#example").on("input change", update);
|
46 |
-
$("#polar").on("input change", update);
|
47 |
-
$("#azimuth").on("input change", update);
|
48 |
-
$("#zoom").on("input change", update);
|
49 |
-
$("#seed").on("input change", update);
|
50 |
-
update();
|
51 |
-
});
|
52 |
-
</script>
|
53 |
-
<style>
|
54 |
-
#originalim, #novelim {
|
55 |
-
width : 300px;
|
56 |
-
height : 300px;
|
57 |
-
border : 1px solid black;
|
58 |
-
}
|
59 |
-
.control-label {
|
60 |
-
width : 75px;
|
61 |
-
display : inline-block;
|
62 |
-
text-align : right;
|
63 |
-
}
|
64 |
-
</style>
|
65 |
-
</head>
|
66 |
-
<body>
|
67 |
-
|
68 |
-
<div class="viewer">
|
69 |
-
<img id="originalim">
|
70 |
-
<img id="novelim"><br>
|
71 |
-
|
72 |
-
<div id="controls">
|
73 |
-
<span class="control-label">Dataset:</span> <select id="dataset">
|
74 |
-
<option value="GSO">GSO</option>
|
75 |
-
<option value="nerf_wild">nerf_wild</option>
|
76 |
-
<option value="RTMV">RTMV</option>
|
77 |
-
</select><br>
|
78 |
-
<span class="control-label">Example:</span> <select id="example">
|
79 |
-
<option value="alma">Alma</option>
|
80 |
-
<option value="bike">Bike</option>
|
81 |
-
<option value="car1">Car 1</option>
|
82 |
-
<option value="car2">Car 2</option>
|
83 |
-
</select><br>
|
84 |
-
<span class="control-label">Polar:</span> <input type="range" id="polar" min="-30" max="30" step="30" value="0"><span class="control-value" id="polar-val"></span><br>
|
85 |
-
<span class="control-label">Azimuth:</span> <input type="range" id="azimuth" min="0" max="330" step="30" value="0"> <span class="control-value" id="azimuth-val"></span><br>
|
86 |
-
<span class="control-label">Zoom:</span> <input type="range" id="zoom" min="-1" max="1" step="1" value="0"> <span class="control-value" id="zoom-val"></span><br>
|
87 |
-
<span class="control-label">Seed:</span> <input type="range" id="seed" min="0" max="4" step="1" value="0"> <span class="control-value" id="seed-val"></span>
|
88 |
-
</div>
|
89 |
-
</div>
|
90 |
-
|
91 |
-
</body>
|
92 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
run.ipynb
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
-
"execution_count":
|
16 |
"id": 2.8891853944186117e+38,
|
17 |
"metadata": {
|
18 |
"colab": {
|
@@ -28,9 +28,7 @@
|
|
28 |
"name": "stdout",
|
29 |
"output_type": "stream",
|
30 |
"text": [
|
31 |
-
"\n",
|
32 |
-
"Thanks for being a Gradio user! If you have questions or feedback, please join our Discord server and chat with us: https://discord.gg/feTf9x3ZSB\n",
|
33 |
-
"Running on local URL: http://127.0.0.1:7908\n",
|
34 |
"\n",
|
35 |
"To create a public link, set `share=True` in `launch()`.\n"
|
36 |
]
|
@@ -38,7 +36,7 @@
|
|
38 |
{
|
39 |
"data": {
|
40 |
"text/html": [
|
41 |
-
"<div><iframe src=\"http://127.0.0.1:
|
42 |
],
|
43 |
"text/plain": [
|
44 |
"<IPython.core.display.HTML object>"
|
@@ -79,8 +77,8 @@
|
|
79 |
" default_input_image = Image.open( os.path.join('online_demo', 'nerf_wild', 'step-100_scale-6.0', 'car1', 'input.png'))\n",
|
80 |
" input_image = gr.Image(default_input_image, shape=[256, 256])\n",
|
81 |
" options = sorted(os.listdir('online_demo/nerf_wild/step-100_scale-6.0'))\n",
|
82 |
-
" img_id = gr.Dropdown(options, value='car1')\n",
|
83 |
-
" text_button = gr.Button(\"
|
84 |
" retrieve_input_image_dataset = partial(retrieve_input_image, 'nerf_wild')\n",
|
85 |
" text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)\n",
|
86 |
"\n",
|
@@ -102,7 +100,7 @@
|
|
102 |
" default_input_image = Image.open( os.path.join('online_demo', 'GSO', 'step-100_scale-6.0', 'SAMBA_HEMP', 'input.png'))\n",
|
103 |
" input_image = gr.Image(default_input_image, shape=[256, 256])\n",
|
104 |
" options = sorted(os.listdir('online_demo/GSO/step-100_scale-6.0'))\n",
|
105 |
-
" img_id = gr.Dropdown(options, value='SAMBA_HEMP')\n",
|
106 |
" text_button = gr.Button(\"Choose Input Image\")\n",
|
107 |
" retrieve_input_image_dataset = partial(retrieve_input_image, 'GSO')\n",
|
108 |
" text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)\n",
|
@@ -125,7 +123,7 @@
|
|
125 |
" default_input_image = Image.open( os.path.join('online_demo', 'RTMV', 'step-100_scale-6.0', '00000', 'input.png'))\n",
|
126 |
" input_image = gr.Image(default_input_image, shape=[256, 256])\n",
|
127 |
" options = sorted(os.listdir('online_demo/RTMV/step-100_scale-6.0'))\n",
|
128 |
-
" img_id = gr.Dropdown(options, value='00000')\n",
|
129 |
" text_button = gr.Button(\"Choose Input Image\")\n",
|
130 |
" retrieve_input_image_dataset = partial(retrieve_input_image, 'RTMV')\n",
|
131 |
" text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)\n",
|
@@ -150,12 +148,77 @@
|
|
150 |
},
|
151 |
{
|
152 |
"cell_type": "code",
|
153 |
-
"execution_count":
|
154 |
"id": "bk8_q39r_iGt",
|
155 |
"metadata": {
|
156 |
"id": "bk8_q39r_iGt"
|
157 |
},
|
158 |
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
"source": []
|
160 |
}
|
161 |
],
|
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
+
"execution_count": 23,
|
16 |
"id": 2.8891853944186117e+38,
|
17 |
"metadata": {
|
18 |
"colab": {
|
|
|
28 |
"name": "stdout",
|
29 |
"output_type": "stream",
|
30 |
"text": [
|
31 |
+
"Running on local URL: http://127.0.0.1:7868\n",
|
|
|
|
|
32 |
"\n",
|
33 |
"To create a public link, set `share=True` in `launch()`.\n"
|
34 |
]
|
|
|
36 |
{
|
37 |
"data": {
|
38 |
"text/html": [
|
39 |
+
"<div><iframe src=\"http://127.0.0.1:7868/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
40 |
],
|
41 |
"text/plain": [
|
42 |
"<IPython.core.display.HTML object>"
|
|
|
77 |
" default_input_image = Image.open( os.path.join('online_demo', 'nerf_wild', 'step-100_scale-6.0', 'car1', 'input.png'))\n",
|
78 |
" input_image = gr.Image(default_input_image, shape=[256, 256])\n",
|
79 |
" options = sorted(os.listdir('online_demo/nerf_wild/step-100_scale-6.0'))\n",
|
80 |
+
" img_id = gr.Dropdown(options, value='car1', label='options')\n",
|
81 |
+
" text_button = gr.Button(\"Load Input Image\")\n",
|
82 |
" retrieve_input_image_dataset = partial(retrieve_input_image, 'nerf_wild')\n",
|
83 |
" text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)\n",
|
84 |
"\n",
|
|
|
100 |
" default_input_image = Image.open( os.path.join('online_demo', 'GSO', 'step-100_scale-6.0', 'SAMBA_HEMP', 'input.png'))\n",
|
101 |
" input_image = gr.Image(default_input_image, shape=[256, 256])\n",
|
102 |
" options = sorted(os.listdir('online_demo/GSO/step-100_scale-6.0'))\n",
|
103 |
+
" img_id = gr.Dropdown(options, value='SAMBA_HEMP', label='options')\n",
|
104 |
" text_button = gr.Button(\"Choose Input Image\")\n",
|
105 |
" retrieve_input_image_dataset = partial(retrieve_input_image, 'GSO')\n",
|
106 |
" text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)\n",
|
|
|
123 |
" default_input_image = Image.open( os.path.join('online_demo', 'RTMV', 'step-100_scale-6.0', '00000', 'input.png'))\n",
|
124 |
" input_image = gr.Image(default_input_image, shape=[256, 256])\n",
|
125 |
" options = sorted(os.listdir('online_demo/RTMV/step-100_scale-6.0'))\n",
|
126 |
+
" img_id = gr.Dropdown(options, value='00000', label='options')\n",
|
127 |
" text_button = gr.Button(\"Choose Input Image\")\n",
|
128 |
" retrieve_input_image_dataset = partial(retrieve_input_image, 'RTMV')\n",
|
129 |
" text_button.click(retrieve_input_image_dataset, inputs=img_id, outputs=input_image)\n",
|
|
|
148 |
},
|
149 |
{
|
150 |
"cell_type": "code",
|
151 |
+
"execution_count": 8,
|
152 |
"id": "bk8_q39r_iGt",
|
153 |
"metadata": {
|
154 |
"id": "bk8_q39r_iGt"
|
155 |
},
|
156 |
"outputs": [],
|
157 |
+
"source": [
|
158 |
+
"img_id = gr.Dropdown(options, value='car1')"
|
159 |
+
]
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"cell_type": "code",
|
163 |
+
"execution_count": 13,
|
164 |
+
"id": "e91860b3",
|
165 |
+
"metadata": {},
|
166 |
+
"outputs": [
|
167 |
+
{
|
168 |
+
"name": "stderr",
|
169 |
+
"output_type": "stream",
|
170 |
+
"text": [
|
171 |
+
"/home/rliu/anaconda3/lib/python3.9/site-packages/gradio/utils.py:805: UserWarning: Expected 2 arguments for function <function retrieve_input_image at 0x7ffabc3310d0>, received 0.\n",
|
172 |
+
" warnings.warn(\n",
|
173 |
+
"/home/rliu/anaconda3/lib/python3.9/site-packages/gradio/utils.py:809: UserWarning: Expected at least 2 arguments for function <function retrieve_input_image at 0x7ffabc3310d0>, received 0.\n",
|
174 |
+
" warnings.warn(\n"
|
175 |
+
]
|
176 |
+
},
|
177 |
+
{
|
178 |
+
"ename": "AttributeError",
|
179 |
+
"evalue": "change() and other events can only be called within a Blocks context.",
|
180 |
+
"output_type": "error",
|
181 |
+
"traceback": [
|
182 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
183 |
+
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
|
184 |
+
"\u001b[0;32m/tmp/ipykernel_2769604/1401407332.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mimg_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretrieve_input_image\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
185 |
+
"\u001b[0;32m~/anaconda3/lib/python3.9/site-packages/gradio/events.py\u001b[0m in \u001b[0;36mchange\u001b[0;34m(self, fn, inputs, outputs, api_name, status_tracker, scroll_to_output, show_progress, queue, batch, max_batch_size, preprocess, postprocess, cancels, every, _js)\u001b[0m\n\u001b[1;32m 79\u001b[0m \u001b[0;34m\"The 'status_tracker' parameter has been deprecated and has no effect.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 80\u001b[0m )\n\u001b[0;32m---> 81\u001b[0;31m dep = self.set_event_trigger(\n\u001b[0m\u001b[1;32m 82\u001b[0m \u001b[0;34m\"change\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 83\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
186 |
+
"\u001b[0;32m~/anaconda3/lib/python3.9/site-packages/gradio/blocks.py\u001b[0m in \u001b[0;36mset_event_trigger\u001b[0;34m(self, event_name, fn, inputs, outputs, preprocess, postprocess, scroll_to_output, show_progress, api_name, js, no_target, queue, batch, max_batch_size, cancels, every)\u001b[0m\n\u001b[1;32m 192\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 193\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mContext\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroot_block\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 194\u001b[0;31m raise AttributeError(\n\u001b[0m\u001b[1;32m 195\u001b[0m \u001b[0;34mf\"{event_name}() and other events can only be called within a Blocks context.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 196\u001b[0m )\n",
|
187 |
+
"\u001b[0;31mAttributeError\u001b[0m: change() and other events can only be called within a Blocks context."
|
188 |
+
]
|
189 |
+
}
|
190 |
+
],
|
191 |
+
"source": [
|
192 |
+
"img_id.change(retrieve_input_image)"
|
193 |
+
]
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"cell_type": "code",
|
197 |
+
"execution_count": 17,
|
198 |
+
"id": "ab10a43f",
|
199 |
+
"metadata": {},
|
200 |
+
"outputs": [
|
201 |
+
{
|
202 |
+
"data": {
|
203 |
+
"text/plain": [
|
204 |
+
"'car1'"
|
205 |
+
]
|
206 |
+
},
|
207 |
+
"execution_count": 17,
|
208 |
+
"metadata": {},
|
209 |
+
"output_type": "execute_result"
|
210 |
+
}
|
211 |
+
],
|
212 |
+
"source": [
|
213 |
+
"img_id.value"
|
214 |
+
]
|
215 |
+
},
|
216 |
+
{
|
217 |
+
"cell_type": "code",
|
218 |
+
"execution_count": null,
|
219 |
+
"id": "2febec07",
|
220 |
+
"metadata": {},
|
221 |
+
"outputs": [],
|
222 |
"source": []
|
223 |
}
|
224 |
],
|