Spaces:
Running
on
Zero
Running
on
Zero
xierui.0097
commited on
Commit
·
0b80321
1
Parent(s):
02a1749
zerogpu
Browse files- app.py +9 -9
- video_super_resolution/scripts/inference_sr.py +3 -3
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import spaces
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
-
from video_super_resolution.scripts.inference_sr import
|
5 |
|
6 |
examples = [
|
7 |
["examples/023_klingai_reedit.mp4", "The video shows a panda strumming a guitar on a rock by a tranquil lake at sunset. With its black-and-white fur, the panda sits against a backdrop of mountains and a vibrant sky painted in orange and pink hues. The serene scene highlights relaxation and whimsy, with the panda, guitar, and lake harmoniously positioned. The natural landscape's depth and perspective enhance the focus on the panda's peaceful interaction with the guitar.", 4, 24, 250],
|
@@ -12,14 +12,14 @@ examples = [
|
|
12 |
# Define a GPU-decorated function for enhancement
|
13 |
@spaces.GPU(duration=120)
|
14 |
def enhance_with_gpu(input_video, input_text):
|
15 |
-
return
|
16 |
|
17 |
def star_demo(result_dir="./tmp/"):
|
18 |
css = """#input_video {max-width: 1024px !important} #output_vid {max-width: 2048px; max-height:1280px}"""
|
19 |
-
global
|
20 |
-
|
21 |
|
22 |
-
with gr.Blocks(analytics_enabled=False, css=css) as
|
23 |
gr.Markdown(
|
24 |
"<div align='center'> <h1> STAR: Spatial-Temporal Augmentation with Text-to-Video Models for Real-World Video Super-Resolution </span> </h1> \
|
25 |
<a style='font-size:18px;color: #000000' href='https://arxiv.org/abs/2501.02976'> [ArXiv] </a>\
|
@@ -53,11 +53,11 @@ def star_demo(result_dir="./tmp/"):
|
|
53 |
fn=enhance_with_gpu, # Use the GPU-decorated function
|
54 |
)
|
55 |
|
56 |
-
return
|
57 |
|
58 |
|
59 |
if __name__ == "__main__":
|
60 |
result_dir = os.path.join("./", "results")
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
1 |
import spaces
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
+
from video_super_resolution.scripts.inference_sr import STAR_sr
|
5 |
|
6 |
examples = [
|
7 |
["examples/023_klingai_reedit.mp4", "The video shows a panda strumming a guitar on a rock by a tranquil lake at sunset. With its black-and-white fur, the panda sits against a backdrop of mountains and a vibrant sky painted in orange and pink hues. The serene scene highlights relaxation and whimsy, with the panda, guitar, and lake harmoniously positioned. The natural landscape's depth and perspective enhance the focus on the panda's peaceful interaction with the guitar.", 4, 24, 250],
|
|
|
12 |
# Define a GPU-decorated function for enhancement
|
13 |
@spaces.GPU(duration=120)
|
14 |
def enhance_with_gpu(input_video, input_text):
|
15 |
+
return star.enhance_a_video(input_video, input_text)
|
16 |
|
17 |
def star_demo(result_dir="./tmp/"):
|
18 |
css = """#input_video {max-width: 1024px !important} #output_vid {max-width: 2048px; max-height:1280px}"""
|
19 |
+
global star
|
20 |
+
star = STAR_sr(result_dir)
|
21 |
|
22 |
+
with gr.Blocks(analytics_enabled=False, css=css) as star_iface:
|
23 |
gr.Markdown(
|
24 |
"<div align='center'> <h1> STAR: Spatial-Temporal Augmentation with Text-to-Video Models for Real-World Video Super-Resolution </span> </h1> \
|
25 |
<a style='font-size:18px;color: #000000' href='https://arxiv.org/abs/2501.02976'> [ArXiv] </a>\
|
|
|
53 |
fn=enhance_with_gpu, # Use the GPU-decorated function
|
54 |
)
|
55 |
|
56 |
+
return star_iface
|
57 |
|
58 |
|
59 |
if __name__ == "__main__":
|
60 |
result_dir = os.path.join("./", "results")
|
61 |
+
star_iface = star_demo(result_dir)
|
62 |
+
star_iface.queue(max_size=12)
|
63 |
+
star_iface.launch(max_threads=1)
|
video_super_resolution/scripts/inference_sr.py
CHANGED
@@ -15,7 +15,7 @@ from inference_utils import *
|
|
15 |
logger = get_logger()
|
16 |
|
17 |
|
18 |
-
class
|
19 |
def __init__(self,
|
20 |
result_dir='./results/',
|
21 |
file_name='000_video.mp4',
|
@@ -121,7 +121,7 @@ def main():
|
|
121 |
|
122 |
assert solver_mode in ('fast', 'normal')
|
123 |
|
124 |
-
|
125 |
result_dir=save_dir,
|
126 |
file_name=file_name, # new added
|
127 |
model_path=model_path,
|
@@ -133,7 +133,7 @@ def main():
|
|
133 |
variant_info=None,
|
134 |
)
|
135 |
|
136 |
-
|
137 |
|
138 |
|
139 |
if __name__ == '__main__':
|
|
|
15 |
logger = get_logger()
|
16 |
|
17 |
|
18 |
+
class STAR_sr():
|
19 |
def __init__(self,
|
20 |
result_dir='./results/',
|
21 |
file_name='000_video.mp4',
|
|
|
121 |
|
122 |
assert solver_mode in ('fast', 'normal')
|
123 |
|
124 |
+
star_sr = STAR_sr(
|
125 |
result_dir=save_dir,
|
126 |
file_name=file_name, # new added
|
127 |
model_path=model_path,
|
|
|
133 |
variant_info=None,
|
134 |
)
|
135 |
|
136 |
+
star_sr.enhance_a_video(input_path, prompt)
|
137 |
|
138 |
|
139 |
if __name__ == '__main__':
|