pagezyhf HF Staff commited on
Commit
756c357
·
1 Parent(s): 7fe639d
Files changed (2) hide show
  1. app.py +5 -36
  2. requirements.txt +2 -1
app.py CHANGED
@@ -2,46 +2,15 @@ import gradio as gr
2
  import requests
3
  import json
4
  import logging
5
- import os
 
6
 
7
  # Set up logging
8
  logging.basicConfig(level=logging.INFO)
9
 
10
- def get_model_info(model_id="Qwen/Qwen2-7B-Instruct", hf_token=os.getenv('HF_TOKEN')):
11
- url = f"https://huggingface.co/api/integrations/aws/v1/lookup/{model_id}"
12
-
13
- headers = {}
14
- if hf_token:
15
- headers["Authorization"] = f"Bearer {hf_token}"
16
- try:
17
- response = requests.get(url, headers=headers)
18
- except requests.exceptions.RequestException as e:
19
- print(f"Error fetching data for task text-generation: {e}")
20
- return None
21
- data = response.json()
22
- return json.dumps(data, indent=4)
23
-
24
- # url = f"https://huggingface.co/api/integrations/aws/v1/lookup/{model_id}"
25
- # headers = {
26
- # "Authorization": f"Bearer {hf_token}",
27
- # }
28
-
29
- # logging.info(f"Requesting model info for model ID: {model_id}")
30
- # logging.info(f"URL: {url}")
31
-
32
- # response = requests.get(url, headers=headers)
33
-
34
- # logging.info(f"Response Status: {response.status_code}")
35
- # logging.info(f"Response Headers: {response.headers}")
36
- # logging.info(f"Response Text: {response.text}")
37
-
38
- # if response.status_code != 200:
39
- # logging.error(f"Error: {response.status_code} - {response.text}")
40
- # return f"Error: {response.status_code}\\nResponse: {response.text}"
41
-
42
- # data = response.json()
43
- # logging.info("Successfully retrieved model info.")
44
- # return json.dumps(data, indent=4)
45
 
46
  iface = gr.Interface(
47
  fn=lambda model_id: get_model_info(model_id, hf_token=os.getenv('HF_TOKEN')),
 
2
  import requests
3
  import json
4
  import logging
5
+ from optimum.neuron import utils
6
+
7
 
8
  # Set up logging
9
  logging.basicConfig(level=logging.INFO)
10
 
11
+ def get_model_info(model_id="Qwen/Qwen2-7B-Instruct"):
12
+ config_list = utils.get_hub_cached_entries(model_id=model_id, mode="inference")
13
+ return config_list
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  iface = gr.Interface(
16
  fn=lambda model_id: get_model_info(model_id, hf_token=os.getenv('HF_TOKEN')),
requirements.txt CHANGED
@@ -1 +1,2 @@
1
- requests==2.32.3
 
 
1
+ requests==2.32.3
2
+ optimum-neuron==0.1.0