Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# The model endpoint on Hugging Face
|
5 |
+
API_URL = "https://api-inference.huggingface.co/models/neovalle/H4rmoniousBreeze"
|
6 |
+
|
7 |
+
def query_model(prompt):
|
8 |
+
# If your model is public, you may not need an API token.
|
9 |
+
# If it’s private, you'll need:
|
10 |
+
# headers = {"Authorization": "Bearer hf_..."}
|
11 |
+
# and pass them in your requests.post(...) call.
|
12 |
+
payload = {"inputs": prompt}
|
13 |
+
response = requests.post(API_URL, json=payload)
|
14 |
+
return response.json()
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=query_model,
|
18 |
+
inputs="text",
|
19 |
+
outputs="text",
|
20 |
+
title="H4rmoniousBreeze",
|
21 |
+
description="Score narratives"
|
22 |
+
)
|
23 |
+
|
24 |
+
if __name__ == "__main__":
|
25 |
+
demo.launch()
|