mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-27 02:30:17 +08:00
huggingface api key setup
This commit is contained in:
parent
afd55beb3b
commit
2c83ef9291
@ -6,7 +6,8 @@ from gradio import inputs, outputs
|
||||
|
||||
def get_huggingface_interface(model_name, api_key):
|
||||
api_url = "https://api-inference.huggingface.co/models/{}".format(model_name)
|
||||
|
||||
headers = {"Authorization": f"Bearer {api_key}"}
|
||||
|
||||
# Checking if model exists, and if so, it gets the pipeline
|
||||
response = requests.request("GET", api_url)
|
||||
assert response.status_code == 200, "Invalid model name or src"
|
||||
|
Loading…
Reference in New Issue
Block a user