Robert Boscacci commited on
Commit
1a26e22
·
1 Parent(s): 4c907c5

Fix examples

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. app.py +5 -7
  3. examples/wolf_1.png +3 -0
  4. examples/wolf_2.png +3 -0
.gitattributes CHANGED
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  export.pkl filter=lfs diff=lfs merge=lfs -text
37
  examples/forrest_1.png filter=lfs diff=lfs merge=lfs -text
38
  examples/forrest_2.png filter=lfs diff=lfs merge=lfs -text
 
 
36
  export.pkl filter=lfs diff=lfs merge=lfs -text
37
  examples/forrest_1.png filter=lfs diff=lfs merge=lfs -text
38
  examples/forrest_2.png filter=lfs diff=lfs merge=lfs -text
39
+ *.png filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -122,20 +122,18 @@ try:
122
  outputs=output
123
  )
124
 
125
- # Use absolute paths for examples
126
- example_paths = [
127
- str(Path("examples/forrest_1.png").resolve()),
128
- str(Path("examples/forrest_2.png").resolve())
129
- ]
130
 
131
  gr.Examples(
132
  examples=example_paths,
133
  inputs=input_image
134
  )
135
 
136
- allowed_paths = example_paths
137
 
138
- # Launch the app, allow access to the examples directory for @Gradio
139
  demo.launch(allowed_paths=allowed_paths) # ssr_mode=False
140
  except Exception as e:
141
  print(f"Error occurred: {e}")
 
122
  outputs=output
123
  )
124
 
125
+ # Use all images in the examples folder as examples
126
+ examples_dir = Path("examples").resolve()
127
+ example_paths = [str(p) for p in examples_dir.glob("*") if p.is_file()]
 
 
128
 
129
  gr.Examples(
130
  examples=example_paths,
131
  inputs=input_image
132
  )
133
 
134
+ allowed_paths = [str(examples_dir)]
135
 
136
+ # Launch the app, allow access to the entire examples directory for @Gradio
137
  demo.launch(allowed_paths=allowed_paths) # ssr_mode=False
138
  except Exception as e:
139
  print(f"Error occurred: {e}")
examples/wolf_1.png ADDED

Git LFS Details

  • SHA256: a05d1d615a6f5245dcdc8fac0457ae3b625f608f07c076b3648b98daedf66de1
  • Pointer size: 131 Bytes
  • Size of remote file: 834 kB
examples/wolf_2.png ADDED

Git LFS Details

  • SHA256: c3fe24fff40acc704098f3e29ae131e6ed00001eb82fc0923ab3fe6100b28881
  • Pointer size: 131 Bytes
  • Size of remote file: 923 kB