haotongl commited on
Commit
ce8dcd4
1 Parent(s): 4a6f746

inital version

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -84,6 +84,28 @@ def run(input_file, resolution):
84
  vis_depth, depth_min, depth_max = visualize_depth(depth, ret_minmax=True)
85
  vis_prompt_depth = visualize_depth(prompt_depth[0, 0].detach().cpu().numpy(), depth_min=depth_min, depth_max=depth_max)
86
  vis_prompt_depth = cv2.resize(vis_prompt_depth, (vis_depth.shape[1], vis_depth.shape[0]), interpolation=cv2.INTER_NEAREST)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  # PLY File
89
  ixt_path = os.path.join(input_dir, f'camera_matrix.csv')
@@ -138,7 +160,7 @@ Project Page: [Prompt Depth Anything](https://promptda.github.io/)
138
  Note:
139
  - Currently, this demo only supports inference for the first frame. If you need to obtain all depth frames, please refer to our [GitHub repo](https://github.com/DepthAnything/PromptDA).
140
  - The depth map is stored as uint16, with a unit of millimeters.
141
- - **You can refer to the bottom of this page for a example demo.**
142
  """
143
 
144
  def main():
@@ -189,7 +211,7 @@ def main():
189
  inputs=[input_file, resolution],
190
  outputs=outputs)
191
 
192
- demo.launch()
193
  # def main():
194
  # gr.Interface(
195
  # fn=run,
 
84
  vis_depth, depth_min, depth_max = visualize_depth(depth, ret_minmax=True)
85
  vis_prompt_depth = visualize_depth(prompt_depth[0, 0].detach().cpu().numpy(), depth_min=depth_min, depth_max=depth_max)
86
  vis_prompt_depth = cv2.resize(vis_prompt_depth, (vis_depth.shape[1], vis_depth.shape[0]), interpolation=cv2.INTER_NEAREST)
87
+ # Add text to vis_prompt_depth
88
+ text_x = vis_prompt_depth.shape[1] - 250 + 15
89
+ text_y = vis_prompt_depth.shape[0] - 45 + 27
90
+ vis_prompt_depth = cv2.rectangle(vis_prompt_depth,
91
+ (vis_prompt_depth.shape[1] - 250, vis_prompt_depth.shape[0] - 45),
92
+ (vis_prompt_depth.shape[1] - 5, vis_prompt_depth.shape[0] - 5),
93
+ (70, 70, 70), -1)
94
+ vis_prompt_depth = cv2.putText(vis_prompt_depth, 'Prompt depth',
95
+ (text_x, text_y),
96
+ cv2.FONT_HERSHEY_SIMPLEX,
97
+ 1, (255, 255, 255), 2, cv2.LINE_AA)
98
+
99
+ text_x = 5 + 15
100
+ text_y = vis_depth.shape[0] - 45 + 27
101
+ vis_depth = cv2.rectangle(vis_depth,
102
+ (5, vis_depth.shape[0] - 45),
103
+ (250, vis_depth.shape[0] - 5),
104
+ (70, 70, 70), -1)
105
+ vis_depth = cv2.putText(vis_depth, 'Output depth',
106
+ (text_x, text_y),
107
+ cv2.FONT_HERSHEY_SIMPLEX,
108
+ 1, (255, 255, 255), 2, cv2.LINE_AA)
109
 
110
  # PLY File
111
  ixt_path = os.path.join(input_dir, f'camera_matrix.csv')
 
160
  Note:
161
  - Currently, this demo only supports inference for the first frame. If you need to obtain all depth frames, please refer to our [GitHub repo](https://github.com/DepthAnything/PromptDA).
162
  - The depth map is stored as uint16, with a unit of millimeters.
163
+ - **You can refer to the bottom of this page for an example demo.**
164
  """
165
 
166
  def main():
 
211
  inputs=[input_file, resolution],
212
  outputs=outputs)
213
 
214
+ demo.launch(share=True)
215
  # def main():
216
  # gr.Interface(
217
  # fn=run,