cavargas10 commited on
Commit
6534ad9
Β·
verified Β·
1 Parent(s): e92b7dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -148,18 +148,23 @@ def extract_gaussian(state: dict, req: gr.Request) -> Tuple[str, str]:
148
  torch.cuda.empty_cache()
149
  return gaussian_path, gaussian_path
150
 
151
- def prepare_multi_example() -> List[Image.Image]:
 
 
 
 
 
152
  multi_case = list(set([i.split('_')[0] for i in os.listdir("assets/example_multi_image")]))
153
- images = []
154
  for case in multi_case:
155
- views = []
156
- for i in range(1, 4):
157
- img = Image.open(f'assets/example_multi_image/{case}_{i}.png')
158
- W, H = img.size
159
- img = img.resize((int(W / H * 512), 512))
160
- views.append(img)
161
- images.append(views)
162
- return images
163
 
164
  with gr.Blocks(delete_cache=(600, 600)) as demo:
165
  gr.Markdown("""
 
148
  torch.cuda.empty_cache()
149
  return gaussian_path, gaussian_path
150
 
151
+ def prepare_multi_example() -> List[Tuple[str, str]]:
152
+ """
153
+ Prepare example images for the 'Multiple Images' gallery.
154
+ Returns:
155
+ List[Tuple[str, str]]: A list of tuples containing image paths and captions.
156
+ """
157
  multi_case = list(set([i.split('_')[0] for i in os.listdir("assets/example_multi_image")]))
158
+ examples = []
159
  for case in multi_case:
160
+ case_images = []
161
+ for i in range(1, 4): # Assuming 3 views per case
162
+ img_path = f'assets/example_multi_image/{case}_{i}.png'
163
+ if os.path.exists(img_path): # Ensure the image exists
164
+ case_images.append((img_path, f"View {i}"))
165
+ if case_images: # Only add cases with valid images
166
+ examples.append(case_images)
167
+ return examples
168
 
169
  with gr.Blocks(delete_cache=(600, 600)) as demo:
170
  gr.Markdown("""