Rahatara commited on
Commit
4d4ba0c
·
verified ·
1 Parent(s): f536866

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -6,7 +6,7 @@ import io
6
 
7
  def visualize_texture():
8
  # Load the GLB file
9
- mesh = trimesh.load('train.glb', force= 'mesh')
10
 
11
  # Load the texture image
12
  im = Image.open('defect.jpg')
@@ -20,10 +20,14 @@ def visualize_texture():
20
  color_visuals = trimesh.visual.TextureVisuals(uv=uv, image=im, material=material)
21
 
22
  # Apply the texture to the original mesh
23
- textured_mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces, visual=color_visuals, validate=True, process= False)
24
 
25
- modified_model = textured_mesh.export('trainm.glb')
26
- return modified_model
 
 
 
 
27
 
28
 
29
  with gr.Blocks() as app:
 
6
 
7
  def visualize_texture():
8
  # Load the GLB file
9
+ mesh = trimesh.load('train.glb', force='mesh')
10
 
11
  # Load the texture image
12
  im = Image.open('defect.jpg')
 
20
  color_visuals = trimesh.visual.TextureVisuals(uv=uv, image=im, material=material)
21
 
22
  # Apply the texture to the original mesh
23
+ textured_mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces, visual=color_visuals, validate=True, process=False)
24
 
25
+ # Export the modified model to a file
26
+ textured_mesh.export('trainm.glb')
27
+
28
+ # Return the file path
29
+ return 'trainm.glb'
30
+
31
 
32
 
33
  with gr.Blocks() as app: