Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -3,13 +3,16 @@ import os
|
|
| 3 |
import random
|
| 4 |
import re
|
| 5 |
import sys
|
|
|
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
from pathlib import Path
|
| 8 |
from typing import List, Optional
|
| 9 |
from uuid import uuid4
|
| 10 |
-
|
| 11 |
import gradio as gr
|
| 12 |
import numpy as np
|
|
|
|
| 13 |
import requests
|
| 14 |
from datasets import load_dataset
|
| 15 |
from huggingface_hub import (
|
|
@@ -20,10 +23,6 @@ from huggingface_hub import (
|
|
| 20 |
snapshot_download,
|
| 21 |
)
|
| 22 |
from PIL import Image
|
| 23 |
-
from glob import glob
|
| 24 |
-
import requests
|
| 25 |
-
import re
|
| 26 |
-
import time
|
| 27 |
|
| 28 |
cached_latest_posts_df = None
|
| 29 |
last_fetched = None
|
|
@@ -100,24 +99,26 @@ def load_video(url):
|
|
| 100 |
|
| 101 |
with gr.Blocks() as demo:
|
| 102 |
gr.Markdown("## Preview GamePhysics")
|
|
|
|
| 103 |
|
| 104 |
with gr.Row():
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
|
| 111 |
gr.Markdown("## Latest Posts")
|
| 112 |
|
| 113 |
-
with gr.Column():
|
| 114 |
-
get_latest_pots_btn = gr.Button("Show Latest Posts")
|
| 115 |
-
latest_post_dataframe = gr.Dataframe()
|
| 116 |
-
|
| 117 |
load_btn.click(load_video, inputs=[reddit_id], outputs=[video_player])
|
| 118 |
|
| 119 |
get_latest_pots_btn.click(get_latest_pots, outputs=[latest_post_dataframe])
|
| 120 |
-
|
| 121 |
|
| 122 |
latest_post_dataframe.select(fn=row_selected, outputs=[reddit_id])
|
| 123 |
|
|
|
|
| 3 |
import random
|
| 4 |
import re
|
| 5 |
import sys
|
| 6 |
+
import time
|
| 7 |
from datetime import datetime
|
| 8 |
+
from glob import glob
|
| 9 |
from pathlib import Path
|
| 10 |
from typing import List, Optional
|
| 11 |
from uuid import uuid4
|
| 12 |
+
|
| 13 |
import gradio as gr
|
| 14 |
import numpy as np
|
| 15 |
+
import pandas as pd
|
| 16 |
import requests
|
| 17 |
from datasets import load_dataset
|
| 18 |
from huggingface_hub import (
|
|
|
|
| 23 |
snapshot_download,
|
| 24 |
)
|
| 25 |
from PIL import Image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
cached_latest_posts_df = None
|
| 28 |
last_fetched = None
|
|
|
|
| 99 |
|
| 100 |
with gr.Blocks() as demo:
|
| 101 |
gr.Markdown("## Preview GamePhysics")
|
| 102 |
+
dummt_title = gr.Textbox(visible=False)
|
| 103 |
|
| 104 |
with gr.Row():
|
| 105 |
+
with gr.Column():
|
| 106 |
+
reddit_id = gr.Textbox(
|
| 107 |
+
lines=1, placeholder="Post url or id here", label="URL"
|
| 108 |
+
)
|
| 109 |
+
load_btn = gr.Button("Load")
|
| 110 |
+
video_player = gr.Video()
|
| 111 |
|
| 112 |
+
with gr.Column():
|
| 113 |
+
latest_post_dataframe = gr.Dataframe()
|
| 114 |
+
get_latest_pots_btn = gr.Button("Refresh Latest Posts")
|
| 115 |
|
| 116 |
gr.Markdown("## Latest Posts")
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
load_btn.click(load_video, inputs=[reddit_id], outputs=[video_player])
|
| 119 |
|
| 120 |
get_latest_pots_btn.click(get_latest_pots, outputs=[latest_post_dataframe])
|
| 121 |
+
demo.load(get_latest_pots, outputs=[latest_post_dataframe])
|
| 122 |
|
| 123 |
latest_post_dataframe.select(fn=row_selected, outputs=[reddit_id])
|
| 124 |
|