Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
2f74de8
1
Parent(s):
801d890
fix
Browse files- app.py +1 -1
- inference.py +9 -0
app.py
CHANGED
|
@@ -53,7 +53,7 @@ with block:
|
|
| 53 |
print("depth reconstruction")
|
| 54 |
image = inputs[raw_image]
|
| 55 |
# depth reconstruction
|
| 56 |
-
fig = dpt.
|
| 57 |
return {pcl_figure: fig}
|
| 58 |
|
| 59 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
|
|
|
| 53 |
print("depth reconstruction")
|
| 54 |
image = inputs[raw_image]
|
| 55 |
# depth reconstruction
|
| 56 |
+
fig = dpt.generate_fig2(image)
|
| 57 |
return {pcl_figure: fig}
|
| 58 |
|
| 59 |
depth_reconstruction_btn.click(on_depth_reconstruction_btn_click, components, [pcl_figure], queue=False)
|
inference.py
CHANGED
|
@@ -9,6 +9,7 @@ import requests
|
|
| 9 |
import open3d as o3d
|
| 10 |
import pandas as pd
|
| 11 |
import plotly.express as px
|
|
|
|
| 12 |
|
| 13 |
class DepthPredictor:
|
| 14 |
def __init__(self):
|
|
@@ -60,6 +61,14 @@ class DepthPredictor:
|
|
| 60 |
# Step 6: Create a 3D scatter plot using Plotly Express
|
| 61 |
fig = px.scatter_3d(df, x='x', y='y', z='z', color='red', size=size)
|
| 62 |
return fig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
|
|
|
|
| 9 |
import open3d as o3d
|
| 10 |
import pandas as pd
|
| 11 |
import plotly.express as px
|
| 12 |
+
import matplotlib.pyplot as plt
|
| 13 |
|
| 14 |
class DepthPredictor:
|
| 15 |
def __init__(self):
|
|
|
|
| 61 |
# Step 6: Create a 3D scatter plot using Plotly Express
|
| 62 |
fig = px.scatter_3d(df, x='x', y='y', z='z', color='red', size=size)
|
| 63 |
return fig
|
| 64 |
+
|
| 65 |
+
def generate_fig2(self, image):
|
| 66 |
+
points, colors = self.generate_pcl(image)
|
| 67 |
+
# Step 6: Create a 3D scatter plot using Plotly Express
|
| 68 |
+
fig = plt.figure()
|
| 69 |
+
ax = fig.add_subplot(111, projection='3d')
|
| 70 |
+
ax.scatter(points,size=0.01, c=colors, marker='o')
|
| 71 |
+
return fig
|
| 72 |
|
| 73 |
|
| 74 |
|