Spaces:
Sleeping
Sleeping
Saketh-Reddy
commited on
Commit
•
4401500
1
Parent(s):
51e9b93
Update main.py
Browse files
main.py
CHANGED
@@ -32,14 +32,15 @@ async def webhook(request: Request):
|
|
32 |
# ^ this will throw if token is invalid
|
33 |
|
34 |
delete_repo(repo_id="shellplc/ThirdParty", token = token, repo_type="model",missing_ok=True)
|
35 |
-
|
36 |
r = requests.post(
|
37 |
f"{ENDPOINT}/api/models/SakethTest/ThirdParty/duplicate",
|
38 |
headers=build_hf_headers(token=token),
|
39 |
json={"repository": "shellplc/ThirdParty"},
|
40 |
)
|
41 |
hf_raise_for_status(r)
|
42 |
-
|
|
|
43 |
return {"processed": True}
|
44 |
|
45 |
except Exception as e:
|
@@ -47,6 +48,7 @@ async def webhook(request: Request):
|
|
47 |
f"Error {e}",
|
48 |
None,
|
49 |
)
|
50 |
-
|
|
|
51 |
return {"processed": False}
|
52 |
|
|
|
32 |
# ^ this will throw if token is invalid
|
33 |
|
34 |
delete_repo(repo_id="shellplc/ThirdParty", token = token, repo_type="model",missing_ok=True)
|
35 |
+
print("deleted")
|
36 |
r = requests.post(
|
37 |
f"{ENDPOINT}/api/models/SakethTest/ThirdParty/duplicate",
|
38 |
headers=build_hf_headers(token=token),
|
39 |
json={"repository": "shellplc/ThirdParty"},
|
40 |
)
|
41 |
hf_raise_for_status(r)
|
42 |
+
repo_url = r.json().get("url")
|
43 |
+
print(repo_url)
|
44 |
return {"processed": True}
|
45 |
|
46 |
except Exception as e:
|
|
|
48 |
f"Error {e}",
|
49 |
None,
|
50 |
)
|
51 |
+
else:
|
52 |
+
print("cond didn't match")
|
53 |
return {"processed": False}
|
54 |
|