Spaces:
Runtime error
Runtime error
File size: 738 Bytes
3c444c8 94e7944 |
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 |
import gradio as gr
import requests
def query(data):
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer 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"
}
response = requests.post(
"https://api-inference.huggingface.co/models/h2oai/h2ogpt-gm-oasst1-en-1024-12b",
headers=headers,
json={"inputs": data}
)
result = response.json()
return result.get("generated_text", "No response")
iface = gr.Interface(
fn=query,
inputs=gr.inputs.Textbox(label="Input"),
outputs=gr.outputs.Textbox(label="Output"),
layout="vertical",
title="Hugging Face Chatbot",
description="Enter a message to chat with the model.",
)
iface.launch(server_port=8889) |