imagen / app.py
CosmoAI's picture
Update app.py
5789151
raw
history blame
732 Bytes
# import gradio as gr
# gr.Interface.load("models/deepset/roberta-base-squad2").launch()
import gradio
import requests
import os
auth = os.environ.get('Authorization')
API_URL = "https://api-inference.huggingface.co/models/deepset/roberta-base-squad2"
headers = {"Authorization": auth}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
def my_inference_function(name):
return query({
"inputs": {
"question": name,
"context": "My name is Clara and I live in Berkeley."
},
})
# gradio_interface = gradio.Interface(
# fn = my_inference_function,
# inputs = "text",
# outputs = "text"
# )
# gradio_interface.launch()