File size: 790 Bytes
35429d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gradio as gr
import requests
import json

def get_model_info(model_id):
    url = f"https://huggingface.co/api/integrations/aws/v1/lookup/{model_id}"
    response = requests.get(url)
    
    if response.status_code != 200:
        return f"Error: Unable to fetch data for {model_id}. Status code: {response.status_code}"
    
    data = response.json()
    return json.dumps(data, indent=4)

iface = gr.Interface(
    fn=get_model_info,
    inputs=gr.Textbox(label="Model ID", placeholder="Enter model ID, e.g., HuggingFaceH4/zephyr-7b-beta"),
    outputs=gr.Textbox(label="API Response", lines=20),
    title="Hugging Face Model Lookup",
    description="Enter a model ID to retrieve its AWS integration details from Hugging Face."
)

if __name__ == "__main__":
    iface.launch()