Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import requests
|
| 2 |
|
| 3 |
def query(payload, model_id, api_token):
|
|
@@ -11,6 +14,24 @@ api_token = "hf_XXXXXXXX" # get yours at hf.co/settings/tokens
|
|
| 11 |
data = query("The goal of life is [MASK].", model_id, api_token)
|
| 12 |
|
| 13 |
#u0dar before changing page!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
#gradioblocks interface template
|
| 15 |
gradio as gr
|
| 16 |
|
|
|
|
| 1 |
+
#inference api call template
|
| 2 |
+
|
| 3 |
+
|
| 4 |
import requests
|
| 5 |
|
| 6 |
def query(payload, model_id, api_token):
|
|
|
|
| 14 |
data = query("The goal of life is [MASK].", model_id, api_token)
|
| 15 |
|
| 16 |
#u0dar before changing page!
|
| 17 |
+
#mkvapicalljs-format into and merge this call into the adjacent codeblock templates
|
| 18 |
+
const response = await fetch("https://hazzzardous-rwkv-instruct.hf.space/run/predict", {
|
| 19 |
+
method: "POST",
|
| 20 |
+
headers: { "Content-Type": "application/json" },
|
| 21 |
+
body: JSON.stringify({
|
| 22 |
+
data: [
|
| 23 |
+
"hello world",
|
| 24 |
+
"Freeform",
|
| 25 |
+
40,
|
| 26 |
+
0.9,
|
| 27 |
+
0.85,
|
| 28 |
+
"<|endoftext|>",
|
| 29 |
+
0,
|
| 30 |
+
]
|
| 31 |
+
})
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
const data = await data.json();
|
| 35 |
#gradioblocks interface template
|
| 36 |
gradio as gr
|
| 37 |
|