Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -50,6 +50,8 @@ def display_3d_object(obj_file, texture_file, light_intensity, ambient_intensity
|
|
50 |
colors = color
|
51 |
|
52 |
ambient_intensity = max(0, min(ambient_intensity, 1))
|
|
|
|
|
53 |
fig = go.Figure(data=[
|
54 |
go.Mesh3d(
|
55 |
x=mesh.vertices[:, 0],
|
@@ -63,7 +65,7 @@ def display_3d_object(obj_file, texture_file, light_intensity, ambient_intensity
|
|
63 |
opacity=0.50,
|
64 |
lighting=dict(
|
65 |
ambient=ambient_intensity,
|
66 |
-
diffuse=light_intensity,
|
67 |
specular=0.5,
|
68 |
roughness=0.1,
|
69 |
fresnel=0.2
|
@@ -77,7 +79,7 @@ def display_3d_object(obj_file, texture_file, light_intensity, ambient_intensity
|
|
77 |
])
|
78 |
fig.update_layout(scene=dict(aspectmode='data'))
|
79 |
|
80 |
-
#Cleaning Temp file
|
81 |
if os.path.exists(TEMP_TEXTURE_FILE):
|
82 |
os.remove(TEMP_TEXTURE_FILE)
|
83 |
print(f"Deleted existing file: {TEMP_TEXTURE_FILE}")
|
|
|
50 |
colors = color
|
51 |
|
52 |
ambient_intensity = max(0, min(ambient_intensity, 1))
|
53 |
+
light_intensity = max(0, min(light_intensity, 1)) # Ensure light_intensity is within the valid range
|
54 |
+
|
55 |
fig = go.Figure(data=[
|
56 |
go.Mesh3d(
|
57 |
x=mesh.vertices[:, 0],
|
|
|
65 |
opacity=0.50,
|
66 |
lighting=dict(
|
67 |
ambient=ambient_intensity,
|
68 |
+
diffuse=light_intensity, # Corrected to ensure it's within [0, 1]
|
69 |
specular=0.5,
|
70 |
roughness=0.1,
|
71 |
fresnel=0.2
|
|
|
79 |
])
|
80 |
fig.update_layout(scene=dict(aspectmode='data'))
|
81 |
|
82 |
+
# Cleaning Temp file
|
83 |
if os.path.exists(TEMP_TEXTURE_FILE):
|
84 |
os.remove(TEMP_TEXTURE_FILE)
|
85 |
print(f"Deleted existing file: {TEMP_TEXTURE_FILE}")
|