Spaces:
Sleeping
Sleeping
Commit
·
616746e
1
Parent(s):
e1f5f9a
FIX
Browse files
app.py
CHANGED
|
@@ -57,7 +57,6 @@ def run_glitch(
|
|
| 57 |
image_file: Optional[Path],
|
| 58 |
duration: float,
|
| 59 |
fps: Optional[int],
|
| 60 |
-
base: Optional[int],
|
| 61 |
glitch2_secs: Optional[float],
|
| 62 |
wobble_main: Optional[float],
|
| 63 |
wobble_jitter: Optional[float],
|
|
@@ -93,8 +92,6 @@ def run_glitch(
|
|
| 93 |
]
|
| 94 |
if fps is not None:
|
| 95 |
cmd += ["--fps", str(fps)]
|
| 96 |
-
if base is not None:
|
| 97 |
-
cmd += ["--base", str(base)]
|
| 98 |
if glitch2_secs is not None:
|
| 99 |
cmd += ["--glitch2_secs", str(glitch2_secs)]
|
| 100 |
if wobble_main is not None:
|
|
@@ -139,7 +136,6 @@ def build_ui():
|
|
| 139 |
duration = gr.Number(label="Duration (seconds)", value=5, precision=2)
|
| 140 |
with gr.Accordion("Optional Parameters", open=False):
|
| 141 |
fps = gr.Slider(1, 120, value=30, step=1, label="fps (frames per second)")
|
| 142 |
-
base = gr.Slider(1, 100, value=20, step=1, label="base")
|
| 143 |
glitch2_secs = gr.Number(value=0.0, precision=2, label="glitch2_secs")
|
| 144 |
wobble_main = gr.Number(value=0.0, precision=2, label="wobble_main")
|
| 145 |
wobble_jitter = gr.Number(value=0.0, precision=2, label="wobble_jitter")
|
|
@@ -153,7 +149,6 @@ def build_ui():
|
|
| 153 |
|
| 154 |
def _wrap(*args):
|
| 155 |
path = run_glitch(*args)
|
| 156 |
-
# Gradio returns a hosted URL when a File component is used. We emit both.
|
| 157 |
return path, path
|
| 158 |
|
| 159 |
run_btn.click(
|
|
@@ -163,7 +158,6 @@ def build_ui():
|
|
| 163 |
image_file,
|
| 164 |
duration,
|
| 165 |
fps,
|
| 166 |
-
base,
|
| 167 |
glitch2_secs,
|
| 168 |
wobble_main,
|
| 169 |
wobble_jitter,
|
|
@@ -174,7 +168,6 @@ def build_ui():
|
|
| 174 |
outputs=[output_file, url_box],
|
| 175 |
)
|
| 176 |
|
| 177 |
-
# ---- Lightweight API doc in UI ----
|
| 178 |
gr.Markdown(
|
| 179 |
"""
|
| 180 |
### API Usage
|
|
@@ -189,12 +182,11 @@ def build_ui():
|
|
| 189 |
"https://picsum.photos/seed/abc/800/600", # image_url
|
| 190 |
null, # image_file (null when using URL)
|
| 191 |
5, # duration
|
| 192 |
-
30,
|
| 193 |
]
|
| 194 |
}' \
|
| 195 |
https://<your-username>-glitch-video.hf.space/run/predict
|
| 196 |
```
|
| 197 |
-
The response contains `data[0]` → hosted file URL.
|
| 198 |
|
| 199 |
**Multipart (file upload)**
|
| 200 |
```bash
|
|
@@ -202,10 +194,9 @@ def build_ui():
|
|
| 202 |
-F "data=@-;type=application/json" \
|
| 203 |
-F "files[]=@/path/to/local_image.jpg" \
|
| 204 |
https://<your-username>-glitch-video.hf.space/run/predict <<'JSON'
|
| 205 |
-
{"data": [null, "file", 5, 30,
|
| 206 |
JSON
|
| 207 |
```
|
| 208 |
-
In multipart mode, set the **second** item to the string `"file"` and attach the image in `files[]`.
|
| 209 |
"""
|
| 210 |
)
|
| 211 |
|
|
|
|
| 57 |
image_file: Optional[Path],
|
| 58 |
duration: float,
|
| 59 |
fps: Optional[int],
|
|
|
|
| 60 |
glitch2_secs: Optional[float],
|
| 61 |
wobble_main: Optional[float],
|
| 62 |
wobble_jitter: Optional[float],
|
|
|
|
| 92 |
]
|
| 93 |
if fps is not None:
|
| 94 |
cmd += ["--fps", str(fps)]
|
|
|
|
|
|
|
| 95 |
if glitch2_secs is not None:
|
| 96 |
cmd += ["--glitch2_secs", str(glitch2_secs)]
|
| 97 |
if wobble_main is not None:
|
|
|
|
| 136 |
duration = gr.Number(label="Duration (seconds)", value=5, precision=2)
|
| 137 |
with gr.Accordion("Optional Parameters", open=False):
|
| 138 |
fps = gr.Slider(1, 120, value=30, step=1, label="fps (frames per second)")
|
|
|
|
| 139 |
glitch2_secs = gr.Number(value=0.0, precision=2, label="glitch2_secs")
|
| 140 |
wobble_main = gr.Number(value=0.0, precision=2, label="wobble_main")
|
| 141 |
wobble_jitter = gr.Number(value=0.0, precision=2, label="wobble_jitter")
|
|
|
|
| 149 |
|
| 150 |
def _wrap(*args):
|
| 151 |
path = run_glitch(*args)
|
|
|
|
| 152 |
return path, path
|
| 153 |
|
| 154 |
run_btn.click(
|
|
|
|
| 158 |
image_file,
|
| 159 |
duration,
|
| 160 |
fps,
|
|
|
|
| 161 |
glitch2_secs,
|
| 162 |
wobble_main,
|
| 163 |
wobble_jitter,
|
|
|
|
| 168 |
outputs=[output_file, url_box],
|
| 169 |
)
|
| 170 |
|
|
|
|
| 171 |
gr.Markdown(
|
| 172 |
"""
|
| 173 |
### API Usage
|
|
|
|
| 182 |
"https://picsum.photos/seed/abc/800/600", # image_url
|
| 183 |
null, # image_file (null when using URL)
|
| 184 |
5, # duration
|
| 185 |
+
30, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 # optional params
|
| 186 |
]
|
| 187 |
}' \
|
| 188 |
https://<your-username>-glitch-video.hf.space/run/predict
|
| 189 |
```
|
|
|
|
| 190 |
|
| 191 |
**Multipart (file upload)**
|
| 192 |
```bash
|
|
|
|
| 194 |
-F "data=@-;type=application/json" \
|
| 195 |
-F "files[]=@/path/to/local_image.jpg" \
|
| 196 |
https://<your-username>-glitch-video.hf.space/run/predict <<'JSON'
|
| 197 |
+
{"data": [null, "file", 5, 30, 0, 0, 0, 0, 0, 0]}
|
| 198 |
JSON
|
| 199 |
```
|
|
|
|
| 200 |
"""
|
| 201 |
)
|
| 202 |
|