Spaces:
Running on Zero
Running on Zero
Upload modutils.py
Browse files89 unmodified lines90919293949520 unmodified lines1161171181191201214 unmodified lines12612712812913013197 unmodified lines22923023123223323423523623723889 unmodified linestry:files = api.list_repo_files(repo_id, token=hf_read_token)except Exception as e:return []model_list = []for file in files:20 unmodified linesreturn modelsdef download_private_file(repo_id, path, is_replace):from huggingface_hub import hf_hub_downloadfile = Path(path)4 unmodified linestry:hf_hub_download(repo_id=repo_id, filename=filename, local_dir=dirname, use_auth_token=hf_read_token)except Exception as e:returnif is_replace:file.resolve().rename(newpath.resolve())97 unmodified linesi += 1oldpath = Path(image[0])newpath = oldpathif oldpath.exists():newpath = oldpath.resolve().rename(Path(filename).resolve())output_paths.append(str(newpath))output_images.append((str(newpath), str(filename)))progress(1, desc="Gallery updated.")return gr.update(value=output_images), gr.update(value=output_paths), gr.update(visible=True)89 unmodified lines9091929394959620 unmodified lines1171181191201211221231241254 unmodified lines13013113213313413513697 unmodified lines23423523623723823924024124224324424524624789 unmodified linestry:files = api.list_repo_files(repo_id, token=hf_read_token)except Exception as e:print(f"Error: Failed to list {repo_id}. ")return []model_list = []for file in files:20 unmodified linesreturn modelsprivate_lora_model_list = get_private_lora_model_lists()def download_private_file(repo_id, path, is_replace):from huggingface_hub import hf_hub_downloadfile = Path(path)4 unmodified linestry:hf_hub_download(repo_id=repo_id, filename=filename, local_dir=dirname, use_auth_token=hf_read_token)except Exception as e:print(f"Error: Failed to download {filename}. ")returnif is_replace:file.resolve().rename(newpath.resolve())97 unmodified linesi += 1oldpath = Path(image[0])newpath = oldpathtry:if oldpath.exists():newpath = oldpath.resolve().rename(Path(filename).resolve())except Exception:passfinally:output_paths.append(str(newpath))output_images.append((str(newpath), str(filename)))progress(1, desc="Gallery updated.")return gr.update(value=output_images), gr.update(value=output_paths), gr.update(visible=True)
modutils.py+13-4