File size: 511 Bytes
541fbbe
b05e637
541fbbe
 
b05e637
541fbbe
 
 
 
14ed19e
 
 
 
541fbbe
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#import gradio as gr

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

#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
#demo.launch()

import requests
import os

API_TOKEN = os.getenv("API_KEY")

API_URL = "https://api-inference.huggingface.co/models/gpt2"
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()
data = query("Can you please let us know more details about your ")