Spaces:
Sleeping
Sleeping
Beracles
commited on
Commit
·
4c9c4c6
1
Parent(s):
5711245
pass an arg named caller to logger
Browse files- app.py +1 -1
- app_util.py +8 -8
app.py
CHANGED
|
@@ -110,7 +110,7 @@ def run(hf_token, service, game, functionality, nlp_command):
|
|
| 110 |
outp["proxy-version"] = proxy_version
|
| 111 |
outp["user"] = user_name
|
| 112 |
outp["game"] = game
|
| 113 |
-
app_util.call_logger(outp, token)
|
| 114 |
return json.dumps(outp, indent=4)
|
| 115 |
except Exception as e:
|
| 116 |
return (
|
|
|
|
| 110 |
outp["proxy-version"] = proxy_version
|
| 111 |
outp["user"] = user_name
|
| 112 |
outp["game"] = game
|
| 113 |
+
app_util.call_logger(outp, space, token)
|
| 114 |
return json.dumps(outp, indent=4)
|
| 115 |
except Exception as e:
|
| 116 |
return (
|
app_util.py
CHANGED
|
@@ -3,26 +3,26 @@ import json
|
|
| 3 |
from gradio_client import Client
|
| 4 |
|
| 5 |
|
| 6 |
-
def call_logger(log_info, hf_token) -> None:
|
| 7 |
#######################
|
| 8 |
# logging
|
| 9 |
#######################
|
| 10 |
urls = [
|
| 11 |
-
|
| 12 |
-
|
| 13 |
]
|
| 14 |
|
| 15 |
for url in urls:
|
| 16 |
try:
|
| 17 |
client = Client(
|
| 18 |
url,
|
| 19 |
-
hf_token
|
| 20 |
-
verbose
|
| 21 |
)
|
| 22 |
-
client.submit(json.dumps(log_info))
|
| 23 |
-
print(f
|
| 24 |
except Exception as e:
|
| 25 |
-
print(f
|
| 26 |
|
| 27 |
|
| 28 |
def call_clouddisk(service, arg, hf_token) -> str | None:
|
|
|
|
| 3 |
from gradio_client import Client
|
| 4 |
|
| 5 |
|
| 6 |
+
def call_logger(log_info, caller, hf_token) -> None:
|
| 7 |
#######################
|
| 8 |
# logging
|
| 9 |
#######################
|
| 10 |
urls = [
|
| 11 |
+
"https://hubei-hunan-logger.hf.space",
|
| 12 |
+
"https://hubei-hunan-logger2.hf.space",
|
| 13 |
]
|
| 14 |
|
| 15 |
for url in urls:
|
| 16 |
try:
|
| 17 |
client = Client(
|
| 18 |
url,
|
| 19 |
+
hf_token=hf_token,
|
| 20 |
+
verbose=False,
|
| 21 |
)
|
| 22 |
+
client.submit(json.dumps(log_info), caller)
|
| 23 |
+
print(f"[logging to {url}] OK")
|
| 24 |
except Exception as e:
|
| 25 |
+
print(f"[logging to {url}] error: {e}")
|
| 26 |
|
| 27 |
|
| 28 |
def call_clouddisk(service, arg, hf_token) -> str | None:
|