forked from coffeeorgreentea/jsonformer-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
66 lines (62 loc) · 1.85 KB
/
test.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This file is used to verify your http server acts as expected
# Run it with `python3 test.py``
import requests
model_inputs = {
"prompt": "Generate an example car",
"json_schema": {
"type": "object",
"properties": {
"car": {
"type": "object",
"properties": {
"make": {"type": "string"},
"model": {"type": "string"},
"year": {"type": "number"},
"colors": {
"type": "array",
"items": {"type": "string"}
},
"features": {
"type": "object",
"properties": {
"audio": {
"type": "object",
"properties": {
"brand": {"type": "string"},
"speakers": {"type": "number"},
"hasBluetooth": {"type": "boolean"}
}
},
"safety": {
"type": "object",
"properties": {
"airbags": {"type": "number"},
"parkingSensors": {"type": "boolean"},
"laneAssist": {"type": "boolean"}
}
},
"performance": {
"type": "object",
"properties": {
"engine": {"type": "string"},
"horsepower": {"type": "number"},
"topSpeed": {"type": "number"}
}
}
}
}
}
},
"owner": {
"type": "object",
"properties": {
"firstName": {"type": "string"},
"lastName": {"type": "string"},
"age": {"type": "number"},
}
}
}
}
}
res = requests.post("http://localhost:8000/", json=model_inputs)
print(res.json())