Spaces:
Running
Running
ZeroCommand
commited on
Commit
•
f913de3
1
Parent(s):
41d3b7b
use login button
Browse files
text_classification.py
CHANGED
@@ -102,9 +102,8 @@ def hf_inference_api(model_id, hf_token, payload):
|
|
102 |
except Exception:
|
103 |
return {"error": response.content}
|
104 |
|
105 |
-
def preload_hf_inference_api(model_id):
|
106 |
payload = {"inputs": "This is a test", "options": {"use_cache": True, }}
|
107 |
-
hf_token = os.environ.get(HF_WRITE_TOKEN, default="")
|
108 |
hf_inference_api(model_id, hf_token, payload)
|
109 |
|
110 |
def check_model_pipeline(model_id):
|
|
|
102 |
except Exception:
|
103 |
return {"error": response.content}
|
104 |
|
105 |
+
def preload_hf_inference_api(model_id, hf_token):
|
106 |
payload = {"inputs": "This is a test", "options": {"use_cache": True, }}
|
|
|
107 |
hf_inference_api(model_id, hf_token, payload)
|
108 |
|
109 |
def check_model_pipeline(model_id):
|
text_classification_ui_helpers.py
CHANGED
@@ -179,11 +179,11 @@ def list_labels_and_features_from_dataset(ds_labels, ds_features, model_labels,
|
|
179 |
|
180 |
|
181 |
def precheck_model_ds_enable_example_btn(
|
182 |
-
model_id, dataset_id, dataset_config, dataset_split
|
183 |
):
|
184 |
model_id = strip_model_id_from_url(model_id)
|
185 |
model_task = check_model_task(model_id)
|
186 |
-
preload_hf_inference_api(model_id)
|
187 |
|
188 |
if dataset_config is None or dataset_split is None or len(dataset_config) == 0:
|
189 |
return (
|
|
|
179 |
|
180 |
|
181 |
def precheck_model_ds_enable_example_btn(
|
182 |
+
model_id, dataset_id, dataset_config, dataset_split, profile: gr.OAuthProfile | None, oath_token: gr.OAuthToken | None
|
183 |
):
|
184 |
model_id = strip_model_id_from_url(model_id)
|
185 |
model_task = check_model_task(model_id)
|
186 |
+
preload_hf_inference_api(model_id, oath_token.token)
|
187 |
|
188 |
if dataset_config is None or dataset_split is None or len(dataset_config) == 0:
|
189 |
return (
|