File size: 692 Bytes
1cb836d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import gradio as gr

# The model endpoint on Hugging Face
API_URL = "https://api-inference.huggingface.co/models/neovalle/H4rmoniousBreeze"

def query_model(prompt):
    # If your model is public, you may not need an API token.
    # If it’s private, you'll need:
    # headers = {"Authorization": "Bearer hf_..."} 
    # and pass them in your requests.post(...) call.
    payload = {"inputs": prompt}
    response = requests.post(API_URL, json=payload)
    return response.json()

demo = gr.Interface(
    fn=query_model,
    inputs="text",
    outputs="text",
    title="H4rmoniousBreeze",
    description="Score narratives"
)

if __name__ == "__main__":
    demo.launch()