-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_request.html
More file actions
45 lines (35 loc) · 1.2 KB
/
Copy pathpost_request.html
File metadata and controls
45 lines (35 loc) · 1.2 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Post Request Example using PyScript</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.8.2/core.css">
<script type="module" src="https://pyscript.net/releases/2024.8.2/core.js"></script>
</head>
<body>
<script type="py">
from pyscript import fetch
import json
# The payload
data = {
"prompt": "Tell me more about Samarkand.",
"history": [],
"system_prompt": "You are a specialist in history.",
"temperature": 0.0,
"max_new_tokens": 1024,
"top_p": 0.15,
"repetition_penalty": 1.0
}
# Send data directly (no need for json.dumps)
response = await fetch(
"https://akbartus-mixtralapi.hf.space/generate/",
method="POST",
headers={"Content-Type": "application/json"},
body=json.dumps(data)
)
# Logs the response content
print(await response.json())
</script>
</body>
</html>