Rodrigo_Cobo
commited on
Commit
•
fb6c0ad
1
Parent(s):
aa7a16e
prepare wiggle output
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import numpy as np
|
|
7 |
import matplotlib.pyplot as plt
|
8 |
from PIL import Image
|
9 |
|
10 |
-
def
|
11 |
|
12 |
if not os.path.exists('temp'):
|
13 |
os.system('mkdir temp')
|
@@ -53,11 +53,15 @@ def update(slider, model_type, img):
|
|
53 |
|
54 |
return f'temp/image_depth.jpeg'
|
55 |
|
|
|
|
|
|
|
|
|
56 |
|
57 |
|
58 |
with gr.Blocks() as demo:
|
59 |
gr.Markdown("Start typing below and then click **Run** to see the output.")
|
60 |
-
inp = [
|
61 |
|
62 |
midas_models = ["DPT_Large","DPT_Hybrid","MiDaS_small"]
|
63 |
|
@@ -66,7 +70,13 @@ with gr.Blocks() as demo:
|
|
66 |
with gr.Row():
|
67 |
inp.append(gr.Image(type="pil", label="Input"))
|
68 |
out = gr.Image(type="file", label="Output")
|
69 |
-
btn = gr.Button("
|
70 |
-
btn.click(fn=
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
demo.launch()
|
|
|
7 |
import matplotlib.pyplot as plt
|
8 |
from PIL import Image
|
9 |
|
10 |
+
def calculate_depth(model_type, img):
|
11 |
|
12 |
if not os.path.exists('temp'):
|
13 |
os.system('mkdir temp')
|
|
|
53 |
|
54 |
return f'temp/image_depth.jpeg'
|
55 |
|
56 |
+
def wiggle_effect(slider):
|
57 |
+
|
58 |
+
return f'temp/image_depth.jpeg'
|
59 |
+
|
60 |
|
61 |
|
62 |
with gr.Blocks() as demo:
|
63 |
gr.Markdown("Start typing below and then click **Run** to see the output.")
|
64 |
+
inp = []
|
65 |
|
66 |
midas_models = ["DPT_Large","DPT_Hybrid","MiDaS_small"]
|
67 |
|
|
|
70 |
with gr.Row():
|
71 |
inp.append(gr.Image(type="pil", label="Input"))
|
72 |
out = gr.Image(type="file", label="Output")
|
73 |
+
btn = gr.Button("Calculate depth")
|
74 |
+
btn.click(fn=calculate_depth, inputs=inp, outputs=out)
|
75 |
+
|
76 |
+
inp = [gr.Slider(1,15, default = 2, label='StepCycles',step= 1)]
|
77 |
+
with gr.Row():
|
78 |
+
out = gr.Image(type="file", label="Output")
|
79 |
+
btn = gr.Button("Calculate depth")
|
80 |
+
btn.click(fn=wiggle_effect, inputs=inp, outputs=out)
|
81 |
|
82 |
demo.launch()
|