import gradio as gr | |
import requests | |
import os | |
API_TOKEN = os.environ['API_TOKEN'] | |
API_URL = "https://api-inference.huggingface.co/models/tscholak/cxmefzzi" | |
headers = {"Authorization": f"Bearer {API_TOKEN}"} | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
iface = gr.Interface(fn=query, inputs="text", outputs="text") | |
iface.launch() | |
#output = query({ | |
# "inputs": "The answer to the universe is", | |
#}) |