marcelo1126 commited on
Commit
1961fb5
·
verified ·
1 Parent(s): d527c51

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +7 -5
streamlit_app.py CHANGED
@@ -35,11 +35,13 @@ def get_client(space_id: str, hf_token: Optional[str]) -> Client:
35
  """
36
  if not hf_token:
37
  return Client(space_id)
38
- # Gradio client renamed the token kwarg; try both for compatibility
39
- try:
40
- return Client(space_id, hf_token=hf_token)
41
- except TypeError:
42
- return Client(space_id, token=hf_token)
 
 
43
 
44
 
45
  @dataclass
 
35
  """
36
  if not hf_token:
37
  return Client(space_id)
38
+ # Gradio client renamed the token kwarg; try a few fallbacks for compatibility
39
+ for kwargs in ({"hf_token": hf_token}, {"token": hf_token}, {"headers": {"Authorization": f"Bearer {hf_token}"}}):
40
+ try:
41
+ return Client(space_id, **kwargs)
42
+ except TypeError:
43
+ continue
44
+ return Client(space_id)
45
 
46
 
47
  @dataclass