ngxson HF staff commited on
Commit
064404a
·
verified ·
1 Parent(s): db1f459

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -14,7 +14,7 @@ def fetch_manifest(model_id, tag_name):
14
 
15
  # Initialize output
16
  output = f"Manifest for {model_id}:{tag_name}\n"
17
- output += json.dumps(manifest_data, indent=2) + "\n\n"
18
 
19
  # Find template and params layers
20
  system_layer = next((layer for layer in manifest_data["layers"]
@@ -29,23 +29,23 @@ def fetch_manifest(model_id, tag_name):
29
  system_url = f"https://huggingface.co/v2/{model_id}/blobs/{system_layer['digest']}"
30
  system_response = requests.get(system_url)
31
  system_response.raise_for_status()
32
- output += "System message:\n"
33
- output += system_response.text + "\n\n"
34
-
35
  # Fetch and display template if found
36
  if template_layer:
37
  template_url = f"https://huggingface.co/v2/{model_id}/blobs/{template_layer['digest']}"
38
  template_response = requests.get(template_url)
39
  template_response.raise_for_status()
40
- output += "Template:\n"
41
- output += template_response.text + "\n\n"
42
 
43
  # Fetch and display params if found
44
  if params_layer:
45
  params_url = f"https://huggingface.co/v2/{model_id}/blobs/{params_layer['digest']}"
46
  params_response = requests.get(params_url)
47
  params_response.raise_for_status()
48
- output += "Parameters:\n"
49
  output += json.dumps(params_response.text, indent=2) + "\n"
50
 
51
  return output
@@ -62,7 +62,7 @@ iface = gr.Interface(
62
  gr.Textbox(label="Model ID (e.g., bartowski/Meta-Llama-3.1-8B-Instruct-GGUF)", placeholder="Enter model ID"),
63
  gr.Textbox("latest", label="Tag Name (e.g., latest)", placeholder="Enter tag name")
64
  ],
65
- outputs=gr.Textbox(label="Results", lines=20),
66
  title="Hugging Face Model Manifest Viewer",
67
  description="Enter a Hugging Face model ID and tag name to view its manifest, template, and parameters.",
68
  )
 
14
 
15
  # Initialize output
16
  output = f"Manifest for {model_id}:{tag_name}\n"
17
+ output += json.dumps(manifest_data, indent=2) + "\n"
18
 
19
  # Find template and params layers
20
  system_layer = next((layer for layer in manifest_data["layers"]
 
29
  system_url = f"https://huggingface.co/v2/{model_id}/blobs/{system_layer['digest']}"
30
  system_response = requests.get(system_url)
31
  system_response.raise_for_status()
32
+ output += "\n\n======================\n\nSystem message:\n"
33
+ output += system_response.text + "\n"
34
+
35
  # Fetch and display template if found
36
  if template_layer:
37
  template_url = f"https://huggingface.co/v2/{model_id}/blobs/{template_layer['digest']}"
38
  template_response = requests.get(template_url)
39
  template_response.raise_for_status()
40
+ output += "\n\n======================\n\nTemplate:\n"
41
+ output += template_response.text + "\n"
42
 
43
  # Fetch and display params if found
44
  if params_layer:
45
  params_url = f"https://huggingface.co/v2/{model_id}/blobs/{params_layer['digest']}"
46
  params_response = requests.get(params_url)
47
  params_response.raise_for_status()
48
+ output += "\n\n======================\n\nParameters:\n"
49
  output += json.dumps(params_response.text, indent=2) + "\n"
50
 
51
  return output
 
62
  gr.Textbox(label="Model ID (e.g., bartowski/Meta-Llama-3.1-8B-Instruct-GGUF)", placeholder="Enter model ID"),
63
  gr.Textbox("latest", label="Tag Name (e.g., latest)", placeholder="Enter tag name")
64
  ],
65
+ outputs=gr.Code(label="Results", lines=40),
66
  title="Hugging Face Model Manifest Viewer",
67
  description="Enter a Hugging Face model ID and tag name to view its manifest, template, and parameters.",
68
  )