Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -199,15 +199,26 @@ def row_selected_latest(evt: gr.SelectData):
|
|
199 |
def load_video(url):
|
200 |
post_id = get_reddit_id(url)
|
201 |
video_url = f"https://huggingface.co/datasets/asgaardlab/GamePhysicsDailyDump/resolve/main/data/videos/{post_id}.mp4?download=true"
|
|
|
202 |
|
203 |
# make sure file exists before returning, make a request without downloading the file
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
raise gr.Error(
|
207 |
f"Video is not in the repo, please try another post. - {r.status_code }"
|
208 |
)
|
209 |
|
210 |
-
|
|
|
|
|
|
|
211 |
|
212 |
|
213 |
with gr.Blocks() as demo:
|
|
|
199 |
def load_video(url):
|
200 |
post_id = get_reddit_id(url)
|
201 |
video_url = f"https://huggingface.co/datasets/asgaardlab/GamePhysicsDailyDump/resolve/main/data/videos/{post_id}.mp4?download=true"
|
202 |
+
video_url2 = f"https://huggingface.co/datasets/asgaardlab/GamePhysics-FullResolution/resolve/main/videos/{post_id}/{post_id}.mp4?download=true"
|
203 |
|
204 |
# make sure file exists before returning, make a request without downloading the file
|
205 |
+
r1 = requests.head(video_url)
|
206 |
+
r2 = requests.head(video_url2)
|
207 |
+
|
208 |
+
if (
|
209 |
+
r2.status_code != 200
|
210 |
+
and r2.status_code != 302
|
211 |
+
and r1.status_code != 200
|
212 |
+
and r1.status_code != 302
|
213 |
+
):
|
214 |
raise gr.Error(
|
215 |
f"Video is not in the repo, please try another post. - {r.status_code }"
|
216 |
)
|
217 |
|
218 |
+
if r1.status_code == 200 or r1.status_code == 302:
|
219 |
+
return video_url
|
220 |
+
else:
|
221 |
+
return video_url2
|
222 |
|
223 |
|
224 |
with gr.Blocks() as demo:
|