Update app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,8 @@ def upload_model(source_url, dst_repo, token,civitai_api_key, new_name, dst_repo
|
|
24 |
if not dst_repo:
|
25 |
raise gr.Error("You haven't provided a destination repository.")
|
26 |
|
27 |
-
if not civitai_api_key:
|
28 |
-
raise gr.Error("You haven't provided a Civitai Api Key.")
|
29 |
|
30 |
# Login to Hugging Face Hub
|
31 |
login(token=token)
|
@@ -34,7 +34,7 @@ def upload_model(source_url, dst_repo, token,civitai_api_key, new_name, dst_repo
|
|
34 |
download_dir = "/home/user/apps/downloads/" + str(int(time.time())) + str(random.getrandbits(8)) + "/"
|
35 |
subprocess.check_call(["mkdir", "-p", download_dir])
|
36 |
# Download the model using wget
|
37 |
-
subprocess.check_call(["wget", f"{source_url}
|
38 |
|
39 |
# List files in the download directory
|
40 |
files = os.listdir(download_dir)
|
@@ -76,10 +76,9 @@ def upload_model(source_url, dst_repo, token,civitai_api_key, new_name, dst_repo
|
|
76 |
interface = gr.Interface(
|
77 |
fn=upload_model,
|
78 |
inputs=[
|
79 |
-
gr.Textbox(label="Source URL", placeholder="Source URL Civitai (e.g. https://civitai.com/api/download/models/486156
|
80 |
gr.Textbox(label="Huggingface repository", placeholder="Destination repository HF (e.g. username/repo-name)"),
|
81 |
gr.Textbox(label="Huggingface Token", placeholder="Write access token HF", type="password"),
|
82 |
-
gr.Textbox(label="Civitai Api Key", placeholder="Civitai Api Key", type="password"),
|
83 |
gr.Textbox(label="New name", placeholder="New name for the model file (sdxl.safeTensor with file format)"),
|
84 |
gr.Textbox(label="Huggingface repository Path", placeholder="Destination path within your repository (e.g. /models/Stable-diffusion/)"),
|
85 |
gr.Dropdown(label="Repo Types", choices=REPO_TYPES, value="model"),
|
|
|
24 |
if not dst_repo:
|
25 |
raise gr.Error("You haven't provided a destination repository.")
|
26 |
|
27 |
+
#if not civitai_api_key:
|
28 |
+
#raise gr.Error("You haven't provided a Civitai Api Key.")
|
29 |
|
30 |
# Login to Hugging Face Hub
|
31 |
login(token=token)
|
|
|
34 |
download_dir = "/home/user/apps/downloads/" + str(int(time.time())) + str(random.getrandbits(8)) + "/"
|
35 |
subprocess.check_call(["mkdir", "-p", download_dir])
|
36 |
# Download the model using wget
|
37 |
+
subprocess.check_call(["wget", f"{source_url}", "-P", download_dir])
|
38 |
|
39 |
# List files in the download directory
|
40 |
files = os.listdir(download_dir)
|
|
|
76 |
interface = gr.Interface(
|
77 |
fn=upload_model,
|
78 |
inputs=[
|
79 |
+
gr.Textbox(label="Source URL", placeholder="Source URL Civitai (e.g. https://civitai.com/api/download/models/486156)"),
|
80 |
gr.Textbox(label="Huggingface repository", placeholder="Destination repository HF (e.g. username/repo-name)"),
|
81 |
gr.Textbox(label="Huggingface Token", placeholder="Write access token HF", type="password"),
|
|
|
82 |
gr.Textbox(label="New name", placeholder="New name for the model file (sdxl.safeTensor with file format)"),
|
83 |
gr.Textbox(label="Huggingface repository Path", placeholder="Destination path within your repository (e.g. /models/Stable-diffusion/)"),
|
84 |
gr.Dropdown(label="Repo Types", choices=REPO_TYPES, value="model"),
|