menorki commited on
Commit
e9dbed2
·
verified ·
1 Parent(s): 82711a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import os
3
  import pprint
4
 
 
5
 
6
  dir_models3D = "assets/windmill/models3D/"
7
  dir_images = "assets/windmill/images/"
@@ -9,13 +10,13 @@ dir_videos = "assets/windmill/videos/"
9
 
10
 
11
  model3D_names = [f for f in os.listdir(dir_models3D) if f.endswith('.gltf') or f.endswith('.obj') or f.endswith('.glb') or f.endswith('.splat')]
12
- model3D_files = [dir_models3D + n for n in model3D_names]
13
 
14
  images_names = [f for f in os.listdir(dir_images) if f.endswith('.jpg') or f.endswith('.png')]
15
- images_files = [(dir_images + n , n) for n in images_names]
16
 
17
  video_names = [f for f in os.listdir(dir_videos) if f.endswith('.mp4') or f.endswith('.avi')]
18
- video_files = [dir_videos + n for n in video_names]
19
 
20
 
21
 
@@ -52,7 +53,7 @@ with gr.Blocks(analytics_enabled=False , css=css, theme="bethecloud/storj_theme"
52
  )
53
 
54
  def load_mesh(model_name):
55
- model_file = dir_models3D + model_name
56
  print(f'LOADING MODEL: {model_file}')
57
  # model_viewer.update(value=model_file)
58
  return model_file
@@ -67,7 +68,7 @@ with gr.Blocks(analytics_enabled=False , css=css, theme="bethecloud/storj_theme"
67
  rows=[1],
68
  object_fit="cover",
69
  interactive=False,
70
- value=images_files
71
  )
72
 
73
  with gr.Tab("Videos"):
@@ -82,11 +83,11 @@ with gr.Blocks(analytics_enabled=False , css=css, theme="bethecloud/storj_theme"
82
  interactive=True,
83
  choices=video_names,
84
  value=video_names[0],
85
- label="Selectionner une video:",
86
  )
87
 
88
  def load_video(video_name):
89
- video_file = dir_videos + video_name
90
  print(f'LOADING VIDEO: {video_file}')
91
  return video_file
92
 
@@ -94,4 +95,4 @@ with gr.Blocks(analytics_enabled=False , css=css, theme="bethecloud/storj_theme"
94
 
95
 
96
  if __name__ == "__main__":
97
- demo.launch(debug=True, show_api=True)
 
2
  import os
3
  import pprint
4
 
5
+ BASE_URL = "https://huggingface.co/spaces/menorki/projet-moulin-belle-ile/resolve/main/"
6
 
7
  dir_models3D = "assets/windmill/models3D/"
8
  dir_images = "assets/windmill/images/"
 
10
 
11
 
12
  model3D_names = [f for f in os.listdir(dir_models3D) if f.endswith('.gltf') or f.endswith('.obj') or f.endswith('.glb') or f.endswith('.splat')]
13
+ model3D_files = [BASE_URL + dir_models3D + n for n in model3D_names]
14
 
15
  images_names = [f for f in os.listdir(dir_images) if f.endswith('.jpg') or f.endswith('.png')]
16
+ images_files = [(BASE_URL + dir_images + n , n) for n in images_names]
17
 
18
  video_names = [f for f in os.listdir(dir_videos) if f.endswith('.mp4') or f.endswith('.avi')]
19
+ video_files = [BASE_URL + dir_videos + n for n in video_names]
20
 
21
 
22
 
 
53
  )
54
 
55
  def load_mesh(model_name):
56
+ model_file = BASE_URL + dir_models3D + model_name
57
  print(f'LOADING MODEL: {model_file}')
58
  # model_viewer.update(value=model_file)
59
  return model_file
 
68
  rows=[1],
69
  object_fit="cover",
70
  interactive=False,
71
+ value=images_files,
72
  )
73
 
74
  with gr.Tab("Videos"):
 
83
  interactive=True,
84
  choices=video_names,
85
  value=video_names[0],
86
+ label="Selectionner une video:"
87
  )
88
 
89
  def load_video(video_name):
90
+ video_file = BASE_URL + dir_videos + video_name
91
  print(f'LOADING VIDEO: {video_file}')
92
  return video_file
93
 
 
95
 
96
 
97
  if __name__ == "__main__":
98
+ demo.launch(debug=False, show_api=False)