xierui.0097 commited on
Commit
95709cf
·
1 Parent(s): ae98d36
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -3,34 +3,25 @@ import os
3
  import gradio as gr
4
  from video_super_resolution.scripts.inference_sr import VEnhancer_sr
5
 
6
- examples = [
7
- ["prompts/astronaut.mp4", "An astronaut flying in space, featuring a steady and smooth perspective", 4, 24, 250],
8
- ["prompts/cat.mp4", "A cat wearing sunglasses at a pool", 4, 24, 250],
9
- ["prompts/fish.mp4", "Clown fish swimming through the coral reef", 4, 24, 300],
10
- ["prompts/iron_man.mp4", "Iron Man flying in the sky", 4, 24, 250],
11
- ["prompts/raccoon.mp4", "A cute raccoon playing guitar in a boat on the ocean", 4, 24, 250],
12
- ["prompts/shanghai.mp4", "The bund Shanghai by Hokusai, in the style of Ukiyo", 4, 24, 250],
13
- ["prompts/gwen.mp4", "Gwen Stacy reading a book, black and white", 4, 24, 250],
14
- ]
15
 
16
  # Define a GPU-decorated function for enhancement
17
  @spaces.GPU(duration=1200)
18
  def enhance_with_gpu(input_video, input_text):
19
  return venhancer.enhance_a_video(input_video, input_text)
20
 
21
- def venhancer_demo(result_dir="./tmp/"):
22
  css = """#input_video {max-width: 1024px !important} #output_vid {max-width: 2048px; max-height:1280px}"""
23
  global venhancer
24
  venhancer = VEnhancer_sr(result_dir)
25
 
26
  with gr.Blocks(analytics_enabled=False, css=css) as venhancer_iface:
27
  gr.Markdown(
28
- "<div align='center'> <h1> VEnhancer </span> </h1> \
29
  <a style='font-size:18px;color: #000000' href='https://arxiv.org/abs/2501.02976'> [ArXiv] </a>\
30
  <a style='font-size:18px;color: #000000' href='https://nju-pcalab.github.io/projects/STAR'> [Project Page] </a> \
31
  <a style='font-size:18px;color: #000000' href='https://github.com/NJU-PCALab/STAR'> [Github] </a> </div>"
32
  )
33
- with gr.Tab(label="VEnhancer"):
34
  with gr.Column():
35
  with gr.Row():
36
  with gr.Column():
@@ -62,6 +53,6 @@ def venhancer_demo(result_dir="./tmp/"):
62
 
63
  if __name__ == "__main__":
64
  result_dir = os.path.join("./", "results")
65
- venhancer_iface = venhancer_demo(result_dir)
66
  venhancer_iface.queue(max_size=12)
67
  venhancer_iface.launch(max_threads=1)
 
3
  import gradio as gr
4
  from video_super_resolution.scripts.inference_sr import VEnhancer_sr
5
 
 
 
 
 
 
 
 
 
 
6
 
7
  # Define a GPU-decorated function for enhancement
8
  @spaces.GPU(duration=1200)
9
  def enhance_with_gpu(input_video, input_text):
10
  return venhancer.enhance_a_video(input_video, input_text)
11
 
12
+ def star_demo(result_dir="./tmp/"):
13
  css = """#input_video {max-width: 1024px !important} #output_vid {max-width: 2048px; max-height:1280px}"""
14
  global venhancer
15
  venhancer = VEnhancer_sr(result_dir)
16
 
17
  with gr.Blocks(analytics_enabled=False, css=css) as venhancer_iface:
18
  gr.Markdown(
19
+ "<div align='center'> <h1> STAR </span> </h1> \
20
  <a style='font-size:18px;color: #000000' href='https://arxiv.org/abs/2501.02976'> [ArXiv] </a>\
21
  <a style='font-size:18px;color: #000000' href='https://nju-pcalab.github.io/projects/STAR'> [Project Page] </a> \
22
  <a style='font-size:18px;color: #000000' href='https://github.com/NJU-PCALab/STAR'> [Github] </a> </div>"
23
  )
24
+ with gr.Tab(label="STAR"):
25
  with gr.Column():
26
  with gr.Row():
27
  with gr.Column():
 
53
 
54
  if __name__ == "__main__":
55
  result_dir = os.path.join("./", "results")
56
+ venhancer_iface = star_demo(result_dir)
57
  venhancer_iface.queue(max_size=12)
58
  venhancer_iface.launch(max_threads=1)