Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,10 +19,14 @@ Partial components will be supported in the future.
|
|
19 |
|
20 |
|
21 |
def make_dduf(repo_id: str, destination_repo_id: str, dduf_filename: str, token: str, torch_dtype: str):
|
|
|
22 |
if destination_repo_id == "":
|
23 |
destination_repo_id = repo_id
|
24 |
|
25 |
-
|
|
|
|
|
|
|
26 |
with tempfile.TemporaryDirectory() as tmpdir:
|
27 |
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=_DTYPE_MAP[torch_dtype])
|
28 |
if dduf_filename == "":
|
@@ -34,7 +38,6 @@ def make_dduf(repo_id: str, destination_repo_id: str, dduf_filename: str, token:
|
|
34 |
|
35 |
pipe.save_pretrained(tmpdir, safe_serialization=True)
|
36 |
|
37 |
-
return_message = ""
|
38 |
try:
|
39 |
export_folder_as_dduf(dduf_filename, folder_path=tmpdir)
|
40 |
except Exception as e:
|
@@ -85,4 +88,4 @@ demo = gr.Interface(
|
|
85 |
)
|
86 |
|
87 |
if __name__ == "__main__":
|
88 |
-
demo.launch(debug=True)
|
|
|
19 |
|
20 |
|
21 |
def make_dduf(repo_id: str, destination_repo_id: str, dduf_filename: str, token: str, torch_dtype: str):
|
22 |
+
return_message = ""
|
23 |
if destination_repo_id == "":
|
24 |
destination_repo_id = repo_id
|
25 |
|
26 |
+
try:
|
27 |
+
destination_repo_id = create_repo(repo_id=destination_repo_id, exist_ok=True).repo_id
|
28 |
+
except Exception as e:
|
29 |
+
return_message += f"❌ Got the following error while creating the repository: \n{e}"
|
30 |
with tempfile.TemporaryDirectory() as tmpdir:
|
31 |
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=_DTYPE_MAP[torch_dtype])
|
32 |
if dduf_filename == "":
|
|
|
38 |
|
39 |
pipe.save_pretrained(tmpdir, safe_serialization=True)
|
40 |
|
|
|
41 |
try:
|
42 |
export_folder_as_dduf(dduf_filename, folder_path=tmpdir)
|
43 |
except Exception as e:
|
|
|
88 |
)
|
89 |
|
90 |
if __name__ == "__main__":
|
91 |
+
demo.launch(debug=True, show_error=True)
|