mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-16 00:28:10 +08:00
add check
Former-commit-id: 008f6498977c243c80e87242f05c9cf9573541ac
This commit is contained in:
parent
7b97a79efc
commit
5f1418a68b
@ -29,13 +29,12 @@ def can_preview(dataset_dir: str, dataset: list) -> "gr.Button":
|
|||||||
except Exception:
|
except Exception:
|
||||||
return gr.Button(interactive=False)
|
return gr.Button(interactive=False)
|
||||||
|
|
||||||
|
if len(dataset) == 0 or "file_name" not in dataset_info[dataset[0]]:
|
||||||
|
return gr.Button(interactive=False)
|
||||||
|
|
||||||
local_path = os.path.join(dataset_dir, dataset_info[dataset[0]]["file_name"])
|
local_path = os.path.join(dataset_dir, dataset_info[dataset[0]]["file_name"])
|
||||||
if (
|
if (os.path.isfile(local_path)
|
||||||
len(dataset) > 0
|
or (os.path.isdir(local_path) and len(os.listdir(local_path)) != 0)):
|
||||||
and "file_name" in dataset_info[dataset[0]]
|
|
||||||
and (os.path.isfile(local_path)
|
|
||||||
or (os.path.isdir(local_path)) and len(os.listdir(local_path)) != 0)
|
|
||||||
):
|
|
||||||
return gr.Button(interactive=True)
|
return gr.Button(interactive=True)
|
||||||
else:
|
else:
|
||||||
return gr.Button(interactive=False)
|
return gr.Button(interactive=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user