hf auth
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ from tempfile import NamedTemporaryFile
|
|
17 |
|
18 |
import huggingface_hub
|
19 |
from huggingface_hub.utils import GatedRepoError
|
20 |
-
from huggingface_hub import hf_hub_download, login
|
21 |
|
22 |
import spaces
|
23 |
import gradio as gr
|
@@ -59,14 +59,11 @@ from esm.utils.structure.protein_chain import ProteinChain
|
|
59 |
from transformers import AutoTokenizer
|
60 |
import utils
|
61 |
|
62 |
-
from huggingface_hub import get_hf_file_metadata
|
63 |
-
from huggingface_hub.utils import GatedRepoError
|
64 |
-
|
65 |
def check_permissions(token: Optional[str] = None) -> None:
|
66 |
if token is None:
|
67 |
raise gr.Error("Please log in to use this Space")
|
68 |
try:
|
69 |
-
get_hf_file_metadata(
|
70 |
return
|
71 |
except GatedRepoError:
|
72 |
raise gr.Error("You must have access to ... to run this Space. Please go through the gating process and come back.")
|
|
|
17 |
|
18 |
import huggingface_hub
|
19 |
from huggingface_hub.utils import GatedRepoError
|
20 |
+
from huggingface_hub import get_hf_file_metadata, hf_hub_download, login
|
21 |
|
22 |
import spaces
|
23 |
import gradio as gr
|
|
|
59 |
from transformers import AutoTokenizer
|
60 |
import utils
|
61 |
|
|
|
|
|
|
|
62 |
def check_permissions(token: Optional[str] = None) -> None:
|
63 |
if token is None:
|
64 |
raise gr.Error("Please log in to use this Space")
|
65 |
try:
|
66 |
+
get_hf_file_metadata(url=huggingface_hub.hf_hub_url(repo_id="EvolutionaryScale/esm3-sm-open-v1"), filename="config.json"))
|
67 |
return
|
68 |
except GatedRepoError:
|
69 |
raise gr.Error("You must have access to ... to run this Space. Please go through the gating process and come back.")
|