pagezyhf HF Staff commited on
Commit
35429d6
·
verified ·
1 Parent(s): edb5c23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+ import json
4
+
5
+ def get_model_info(model_id):
6
+ url = f"https://huggingface.co/api/integrations/aws/v1/lookup/{model_id}"
7
+ response = requests.get(url)
8
+
9
+ if response.status_code != 200:
10
+ return f"Error: Unable to fetch data for {model_id}. Status code: {response.status_code}"
11
+
12
+ data = response.json()
13
+ return json.dumps(data, indent=4)
14
+
15
+ iface = gr.Interface(
16
+ fn=get_model_info,
17
+ inputs=gr.Textbox(label="Model ID", placeholder="Enter model ID, e.g., HuggingFaceH4/zephyr-7b-beta"),
18
+ outputs=gr.Textbox(label="API Response", lines=20),
19
+ title="Hugging Face Model Lookup",
20
+ description="Enter a model ID to retrieve its AWS integration details from Hugging Face."
21
+ )
22
+
23
+ if __name__ == "__main__":
24
+ iface.launch()