Spaces:
Sleeping
Sleeping
add
Browse files
app.py
CHANGED
@@ -6,11 +6,12 @@ import logging
|
|
6 |
# Set up logging
|
7 |
logging.basicConfig(level=logging.INFO)
|
8 |
|
9 |
-
def get_model_info(model_id="Qwen/Qwen2-7B-Instruct"):
|
10 |
url = f"https://huggingface.co/api/integrations/aws/v1/lookup/{model_id}"
|
|
|
11 |
logging.info(f"Requesting model info for model ID: {model_id}")
|
12 |
|
13 |
-
response = requests.get(url)
|
14 |
|
15 |
if response.status_code != 200:
|
16 |
logging.error(f"Error: {response.status_code} - {response.text}")
|
@@ -21,8 +22,8 @@ def get_model_info(model_id="Qwen/Qwen2-7B-Instruct"):
|
|
21 |
return json.dumps(data, indent=4)
|
22 |
|
23 |
iface = gr.Interface(
|
24 |
-
fn=get_model_info,
|
25 |
-
inputs=gr.Textbox(label="Model ID", placeholder="
|
26 |
outputs=gr.Textbox(label="API Response", lines=20),
|
27 |
title="Hugging Face Model Lookup",
|
28 |
description="Enter a model ID to retrieve its AWS integration details from Hugging Face."
|
|
|
6 |
# Set up logging
|
7 |
logging.basicConfig(level=logging.INFO)
|
8 |
|
9 |
+
def get_model_info(model_id="Qwen/Qwen2-7B-Instruct", hf_token=None):
|
10 |
url = f"https://huggingface.co/api/integrations/aws/v1/lookup/{model_id}"
|
11 |
+
headers = {"Authorization": f"Bearer {hf_token}"} if hf_token else {}
|
12 |
logging.info(f"Requesting model info for model ID: {model_id}")
|
13 |
|
14 |
+
response = requests.get(url, headers=headers)
|
15 |
|
16 |
if response.status_code != 200:
|
17 |
logging.error(f"Error: {response.status_code} - {response.text}")
|
|
|
22 |
return json.dumps(data, indent=4)
|
23 |
|
24 |
iface = gr.Interface(
|
25 |
+
fn=lambda model_id: get_model_info(model_id, hf_token="YOUR_HF_TOKEN"),
|
26 |
+
inputs=gr.Textbox(label="Model ID", placeholder="HuggingFaceH4/zephyr-7b-beta"),
|
27 |
outputs=gr.Textbox(label="API Response", lines=20),
|
28 |
title="Hugging Face Model Lookup",
|
29 |
description="Enter a model ID to retrieve its AWS integration details from Hugging Face."
|