Spaces:
Runtime error
Runtime error
remove vid
Browse files
app.py
CHANGED
@@ -43,7 +43,6 @@ def infer_video(path_input, seed):
|
|
43 |
|
44 |
def run_demo_server():
|
45 |
infer_gpu = spaces.GPU(functools.partial(infer))
|
46 |
-
infer_video_gpu = spaces.GPU(functools.partial(infer_video))
|
47 |
gradio_theme = gr.themes.Default()
|
48 |
|
49 |
with gr.Blocks(
|
@@ -109,96 +108,49 @@ def run_demo_server():
|
|
109 |
"""
|
110 |
)
|
111 |
with gr.Tabs(elem_classes=["tabs"]):
|
112 |
-
with gr.
|
113 |
-
with gr.
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
123 |
)
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
132 |
type="filepath",
|
133 |
interactive=False,
|
134 |
elem_classes="slider",
|
135 |
position=0.25,
|
136 |
)
|
137 |
-
with gr.Row():
|
138 |
-
image_output_d = ImageSlider(
|
139 |
-
label="Output (Discriminative)",
|
140 |
-
type="filepath",
|
141 |
-
interactive=False,
|
142 |
-
elem_classes="slider",
|
143 |
-
position=0.25,
|
144 |
-
)
|
145 |
-
|
146 |
-
gr.Examples(
|
147 |
-
fn=infer_gpu,
|
148 |
-
examples=sorted([
|
149 |
-
[os.path.join("files", "images", name), 0]
|
150 |
-
for name in os.listdir(os.path.join("files", "images"))
|
151 |
-
]),
|
152 |
-
inputs=[image_input, seed],
|
153 |
-
outputs=[image_output_g, image_output_d],
|
154 |
-
cache_examples=False,
|
155 |
-
)
|
156 |
-
|
157 |
-
with gr.Tab("VIDEO"):
|
158 |
-
with gr.Row():
|
159 |
-
with gr.Column():
|
160 |
-
input_video = gr.Video(
|
161 |
-
label="Input Video",
|
162 |
-
autoplay=True,
|
163 |
-
loop=True,
|
164 |
-
)
|
165 |
-
seed = gr.Number(
|
166 |
-
label="Seed (only for Generative mode)",
|
167 |
-
minimum=0,
|
168 |
-
maximum=999999999,
|
169 |
-
)
|
170 |
-
with gr.Row():
|
171 |
-
video_submit_btn = gr.Button(
|
172 |
-
value="Predict Depth!", variant="primary"
|
173 |
-
)
|
174 |
-
video_reset_btn = gr.Button(value="Reset")
|
175 |
-
with gr.Column():
|
176 |
-
video_output_g = gr.Video(
|
177 |
-
label="Output (Generative)",
|
178 |
-
interactive=False,
|
179 |
-
autoplay=True,
|
180 |
-
loop=True,
|
181 |
-
show_share_button=True,
|
182 |
-
)
|
183 |
-
with gr.Row():
|
184 |
-
video_output_d = gr.Video(
|
185 |
-
label="Output (Discriminative)",
|
186 |
-
interactive=False,
|
187 |
-
autoplay=True,
|
188 |
-
loop=True,
|
189 |
-
show_share_button=True,
|
190 |
-
)
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
|
203 |
### Image
|
204 |
image_submit_btn.click(
|
@@ -218,25 +170,12 @@ def run_demo_server():
|
|
218 |
queue=False,
|
219 |
)
|
220 |
|
221 |
-
### Video
|
222 |
-
video_submit_btn.click(
|
223 |
-
fn=infer_video_gpu,
|
224 |
-
inputs=[input_video, seed],
|
225 |
-
outputs=[video_output_g, video_output_d],
|
226 |
-
queue=True,
|
227 |
-
)
|
228 |
-
video_reset_btn.click(
|
229 |
-
fn=lambda: (None, None, None),
|
230 |
-
inputs=[],
|
231 |
-
outputs=[video_output_g, video_output_d],
|
232 |
-
)
|
233 |
-
|
234 |
### Server launch
|
235 |
demo.queue(
|
236 |
api_open=False,
|
237 |
).launch(
|
238 |
server_name="0.0.0.0",
|
239 |
-
server_port=
|
240 |
)
|
241 |
|
242 |
def main():
|
|
|
43 |
|
44 |
def run_demo_server():
|
45 |
infer_gpu = spaces.GPU(functools.partial(infer))
|
|
|
46 |
gradio_theme = gr.themes.Default()
|
47 |
|
48 |
with gr.Blocks(
|
|
|
108 |
"""
|
109 |
)
|
110 |
with gr.Tabs(elem_classes=["tabs"]):
|
111 |
+
with gr.Row():
|
112 |
+
with gr.Column():
|
113 |
+
image_input = gr.Image(
|
114 |
+
label="Input Image",
|
115 |
+
type="filepath",
|
116 |
+
)
|
117 |
+
seed = gr.Number(
|
118 |
+
label="Seed (only for Generative mode)",
|
119 |
+
minimum=0,
|
120 |
+
maximum=999999999,
|
121 |
+
)
|
122 |
+
with gr.Row():
|
123 |
+
image_submit_btn = gr.Button(
|
124 |
+
value="Predict Depth!", variant="primary"
|
125 |
)
|
126 |
+
image_reset_btn = gr.Button(value="Reset")
|
127 |
+
with gr.Column():
|
128 |
+
image_output_g = ImageSlider(
|
129 |
+
label="Output (Generative)",
|
130 |
+
type="filepath",
|
131 |
+
interactive=False,
|
132 |
+
elem_classes="slider",
|
133 |
+
position=0.25,
|
134 |
+
)
|
135 |
+
with gr.Row():
|
136 |
+
image_output_d = ImageSlider(
|
137 |
+
label="Output (Discriminative)",
|
138 |
type="filepath",
|
139 |
interactive=False,
|
140 |
elem_classes="slider",
|
141 |
position=0.25,
|
142 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
+
gr.Examples(
|
145 |
+
fn=infer_gpu,
|
146 |
+
examples=sorted([
|
147 |
+
[os.path.join("files", "images", name), 0]
|
148 |
+
for name in os.listdir(os.path.join("files", "images"))
|
149 |
+
]),
|
150 |
+
inputs=[image_input, seed],
|
151 |
+
outputs=[image_output_g, image_output_d],
|
152 |
+
cache_examples=False,
|
153 |
+
)
|
154 |
|
155 |
### Image
|
156 |
image_submit_btn.click(
|
|
|
170 |
queue=False,
|
171 |
)
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
### Server launch
|
174 |
demo.queue(
|
175 |
api_open=False,
|
176 |
).launch(
|
177 |
server_name="0.0.0.0",
|
178 |
+
server_port=7861,
|
179 |
)
|
180 |
|
181 |
def main():
|