VanNguyen1214 commited on
Commit
725fc19
·
verified ·
1 Parent(s): 09704f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -12,28 +12,28 @@ class VideoDepthApp:
12
  self.client_url = "depth-anything/Video-Depth-Anything"
13
  self.client = None
14
  self.presets = {
15
- "fast": {
16
  "max_len": 100,
17
  "target_fps": 10,
18
  "max_res": 640,
19
  "grayscale": True,
20
  "description": "Fast processing with lower quality"
21
  },
22
- "balanced": {
23
  "max_len": 300,
24
  "target_fps": 15,
25
  "max_res": 1024,
26
  "grayscale": False,
27
  "description": "Balanced quality and speed"
28
  },
29
- "high_quality": {
30
  "max_len": 500,
31
  "target_fps": 24,
32
  "max_res": 1920,
33
  "grayscale": False,
34
  "description": "High quality processing (slower)"
35
  },
36
- "mobile": {
37
  "max_len": 200,
38
  "target_fps": 12,
39
  "max_res": 720,
@@ -53,7 +53,7 @@ class VideoDepthApp:
53
  def process_video(
54
  self,
55
  video_file,
56
- preset: str = "balanced",
57
  custom_max_len: Optional[int] = 500,
58
  custom_target_fps: Optional[int] = 30,
59
  custom_max_res: Optional[int] = 1080,
@@ -169,7 +169,7 @@ def create_interface():
169
  gr.Markdown("### 📤 Input")
170
  video_input = gr.Video(
171
  label="Upload Video",
172
- height=300
173
  )
174
 
175
  # Preset selection
@@ -182,7 +182,7 @@ def create_interface():
182
  )
183
 
184
  preset_info = gr.Markdown(
185
- app.get_preset_info("balanced")
186
  )
187
 
188
  # Custom parameters
@@ -191,6 +191,7 @@ def create_interface():
191
  minimum=50,
192
  maximum=1000,
193
  step=50,
 
194
  label="Max Length (frames)",
195
  info="Maximum length of the video in frames (default: 500)"
196
  )
@@ -198,6 +199,7 @@ def create_interface():
198
  minimum=5,
199
  maximum=30,
200
  step=1,
 
201
  label="Target FPS",
202
  info="Target frames per second for processing (default: 15)"
203
  )
@@ -205,6 +207,7 @@ def create_interface():
205
  minimum=480,
206
  maximum=1920,
207
  step=160,
 
208
  label="Max Resolution",
209
  info="Maximum resolution for processing (default: 1280)"
210
  )
 
12
  self.client_url = "depth-anything/Video-Depth-Anything"
13
  self.client = None
14
  self.presets = {
15
+ "Fast": {
16
  "max_len": 100,
17
  "target_fps": 10,
18
  "max_res": 640,
19
  "grayscale": True,
20
  "description": "Fast processing with lower quality"
21
  },
22
+ "Balanced": {
23
  "max_len": 300,
24
  "target_fps": 15,
25
  "max_res": 1024,
26
  "grayscale": False,
27
  "description": "Balanced quality and speed"
28
  },
29
+ "High_quality": {
30
  "max_len": 500,
31
  "target_fps": 24,
32
  "max_res": 1920,
33
  "grayscale": False,
34
  "description": "High quality processing (slower)"
35
  },
36
+ "Mobile": {
37
  "max_len": 200,
38
  "target_fps": 12,
39
  "max_res": 720,
 
53
  def process_video(
54
  self,
55
  video_file,
56
+ preset: str = "Balanced",
57
  custom_max_len: Optional[int] = 500,
58
  custom_target_fps: Optional[int] = 30,
59
  custom_max_res: Optional[int] = 1080,
 
169
  gr.Markdown("### 📤 Input")
170
  video_input = gr.Video(
171
  label="Upload Video",
172
+ height=500
173
  )
174
 
175
  # Preset selection
 
182
  )
183
 
184
  preset_info = gr.Markdown(
185
+ app.get_preset_info("Balanced")
186
  )
187
 
188
  # Custom parameters
 
191
  minimum=50,
192
  maximum=1000,
193
  step=50,
194
+ default=500,
195
  label="Max Length (frames)",
196
  info="Maximum length of the video in frames (default: 500)"
197
  )
 
199
  minimum=5,
200
  maximum=30,
201
  step=1,
202
+ default=15,
203
  label="Target FPS",
204
  info="Target frames per second for processing (default: 15)"
205
  )
 
207
  minimum=480,
208
  maximum=1920,
209
  step=160,
210
+ default=1280,
211
  label="Max Resolution",
212
  info="Maximum resolution for processing (default: 1280)"
213
  )