steveagi commited on
Commit
50f732e
·
1 Parent(s): d2df9da

user string as json from hf_token

Browse files
Files changed (3) hide show
  1. app.py +9 -0
  2. req.txt +3 -0
  3. test_extract.py +0 -0
app.py CHANGED
@@ -30,6 +30,15 @@ space = 'stevez-bbc123'
30
  # url = f'https://{space}.hf.space/api/predict'
31
  url = f'https://{space}.hf.space'
32
 
 
 
 
 
 
 
 
 
 
33
  def run(hf_token, service, game, functionality, nlp_command):
34
  if hf_token is None or hf_token == '':
35
  return 'please specify hf token'
 
30
  # url = f'https://{space}.hf.space/api/predict'
31
  url = f'https://{space}.hf.space'
32
 
33
+ def extract(hf_token):
34
+ token = None
35
+ try:
36
+ info = json.loads(hf_token)
37
+ token = info['token']
38
+ except:
39
+ token = hf_token
40
+ print(f't = {token[:5]}')
41
+
42
  def run(hf_token, service, game, functionality, nlp_command):
43
  if hf_token is None or hf_token == '':
44
  return 'please specify hf token'
req.txt CHANGED
@@ -21,6 +21,7 @@ httpx==0.25.0
21
  huggingface-hub==0.18.0
22
  idna==3.4
23
  importlib-resources==6.1.0
 
24
  Jinja2==3.1.2
25
  jsonschema==4.19.1
26
  jsonschema-specifications==2023.7.1
@@ -32,10 +33,12 @@ orjson==3.9.9
32
  packaging==23.2
33
  pandas==2.1.1
34
  Pillow==10.0.1
 
35
  pydantic==2.4.2
36
  pydantic_core==2.10.1
37
  pydub==0.25.1
38
  pyparsing==3.1.1
 
39
  python-dateutil==2.8.2
40
  python-multipart==0.0.6
41
  pytz==2023.3.post1
 
21
  huggingface-hub==0.18.0
22
  idna==3.4
23
  importlib-resources==6.1.0
24
+ iniconfig==2.0.0
25
  Jinja2==3.1.2
26
  jsonschema==4.19.1
27
  jsonschema-specifications==2023.7.1
 
33
  packaging==23.2
34
  pandas==2.1.1
35
  Pillow==10.0.1
36
+ pluggy==1.3.0
37
  pydantic==2.4.2
38
  pydantic_core==2.10.1
39
  pydub==0.25.1
40
  pyparsing==3.1.1
41
+ pytest==7.4.2
42
  python-dateutil==2.8.2
43
  python-multipart==0.0.6
44
  pytz==2023.3.post1
test_extract.py ADDED
File without changes