iljung1106 commited on
Commit
aacdfe6
·
1 Parent(s): d186f38

Show all prototype DB .pt files in dropdown

Browse files
Files changed (1) hide show
  1. webui_gradio.py +15 -3
webui_gradio.py CHANGED
@@ -186,10 +186,22 @@ def _list_ckpt_files(folder: Path) -> List[str]:
186
 
187
 
188
  def _list_proto_files(folder: Path) -> List[str]:
 
 
 
 
 
 
 
189
  files = _list_pt_files(folder)
190
- # heuristics: prototype db files usually contain "proto" in filename
191
- protos = [f for f in files if "proto" in Path(f).name.lower()]
192
- return protos if protos else files
 
 
 
 
 
193
 
194
 
195
  def _guess_default_ckpt(files: List[str]) -> Optional[str]:
 
186
 
187
 
188
  def _list_proto_files(folder: Path) -> List[str]:
189
+ """
190
+ List prototype DB candidates.
191
+
192
+ On Spaces, users may upload prototype DBs with arbitrary names. We therefore:
193
+ - include all *.pt in checkpoints_style
194
+ - but try to exclude obvious training checkpoints like stageX_epochY.pt
195
+ """
196
  files = _list_pt_files(folder)
197
+ out: List[str] = []
198
+ for f in files:
199
+ name = Path(f).name.lower()
200
+ # exclude training checkpoints
201
+ if ("stage" in name) and ("epoch" in name):
202
+ continue
203
+ out.append(f)
204
+ return out if out else files
205
 
206
 
207
  def _guess_default_ckpt(files: List[str]) -> Optional[str]: