File size: 1,303 Bytes
111b72c 4c9c4c6 111b72c 4c9c4c6 111b72c 4c9c4c6 111b72c 4c9c4c6 111b72c 4c9c4c6 111b72c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
import json
from gradio_client import Client
def call_logger(log_info, caller, hf_token) -> None:
#######################
# logging
#######################
urls = [
"https://hubei-hunan-logger.hf.space",
"https://hubei-hunan-logger2.hf.space",
]
for url in urls:
try:
client = Client(
url,
hf_token=hf_token,
verbose=False,
)
client.submit(json.dumps(log_info), caller)
print(f"[logging to {url}] OK")
except Exception as e:
print(f"[logging to {url}] error: {e}")
def call_clouddisk(service, arg, hf_token) -> str | None:
##########################
# upload or download game
##########################
urls = [
"https://pgsoft-clouddisk.hf.space",
# "https://pgsoft-clouddisk2.hf.space",
]
for url in urls:
try:
client = Client(
url,
hf_token=hf_token,
verbose=False,
)
res = client.predict(service, arg, api_name="/predict")
print("[call_clouddisk] OK")
return res
except Exception as e:
print(f"[call_clouddisk] {type(e)}: {e}")
return None
|