steveagi commited on
Commit
896c15b
·
1 Parent(s): 703e6fc

output user

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -32,11 +32,13 @@ space = 'stevez-bbc123'
32
  url = f'https://{space}.hf.space'
33
 
34
  def run(hf_token, service, game, functionality, nlp_command):
35
- if hf_token is None or hf_token == '':
36
- return 'please specify hf token'
37
-
38
  # reuse hf_token field as json string
39
  token, user_name, _ = extract(hf_token)
 
 
 
 
 
40
 
41
  if service not in functionality_shared[1:]:
42
  if game is None:
@@ -49,7 +51,7 @@ def run(hf_token, service, game, functionality, nlp_command):
49
 
50
  try:
51
  if service not in functionality_shared[1:]:
52
- print(f"{datetime.today()} [{game:<16}] {nlp_command}")
53
  # myobj = {
54
  # 'data': [service, game, r, nlp_command],
55
  # }
@@ -65,7 +67,7 @@ def run(hf_token, service, game, functionality, nlp_command):
65
  # res2 = json.loads(res)
66
  client = Client(
67
  url,
68
- hf_token=hf_token,
69
  verbose=False,
70
  )
71
  res = client.predict(
 
32
  url = f'https://{space}.hf.space'
33
 
34
  def run(hf_token, service, game, functionality, nlp_command):
 
 
 
35
  # reuse hf_token field as json string
36
  token, user_name, _ = extract(hf_token)
37
+ if user_name is None:
38
+ user_name = '__fake__'
39
+
40
+ if token is None or token == '':
41
+ return 'please specify hf token'
42
 
43
  if service not in functionality_shared[1:]:
44
  if game is None:
 
51
 
52
  try:
53
  if service not in functionality_shared[1:]:
54
+ print(f"{datetime.today()} [{game:<12}] [{user[:12]:<12}] {nlp_command}")
55
  # myobj = {
56
  # 'data': [service, game, r, nlp_command],
57
  # }
 
67
  # res2 = json.loads(res)
68
  client = Client(
69
  url,
70
+ hf_token=token,
71
  verbose=False,
72
  )
73
  res = client.predict(