File size: 783 Bytes
a33fc8f
9fe7241
a33fc8f
 
 
 
9fe7241
 
 
 
 
 
 
 
 
 
 
 
 
 
95c9d13
9fe7241
 
 
89f4e64
9fe7241
f58b2f0
9fe7241
 
 
 
 
 
8abd9e0
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
26
27
28
29
30
31
32
33
34
35
import gradio as gr
import requests

def greet(name):
    return "Hello " + name + "!!"


def check_carbon_intensity(name: str) -> dict:
    """
    Help get carbon intensity from interesting places

    Args:
        name (str): name of the place

    Returns:
        dict: dictionary
    """

    ""
    headers = {
        "Authorization": f"Bearer XXXXXXXXX"
    }
    
    try:
        response = requests.get('httpsmmmmmNSW', headers=headers)
        response.raise_for_status()  # Raise an exception for HTTP errors
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"An error occurred: {e}")
        return None 


demo = gr.Interface(fn=check_carbon_intensity, inputs="text", outputs=gr.JSON())
demo.launch(mcp_server=True)