-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_client.py
More file actions
58 lines (42 loc) · 1.26 KB
/
Copy pathtest_client.py
File metadata and controls
58 lines (42 loc) · 1.26 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
46
47
48
49
50
51
52
53
54
55
56
57
58
import requests
BASE = "http://127.0.0.1:8787"
def health():
r = requests.get(f"{BASE}/health")
print(r.json())
def load_7b():
r = requests.post(f"{BASE}/swap/load/text_primary")
print(r.json())
def unload_vision():
r = requests.post(f"{BASE}/swap/unload/vision_ocr")
print(r.json())
def ask_text():
payload = {
"model_key": "text_primary",
"messages": [
{"role": "system", "content": "You are concise and precise."},
{"role": "user", "content": "Say whether you are running."}
]
}
r = requests.post(f"{BASE}/chat", json=payload)
print(r.json())
def translate_screenshot():
payload = {
"image_path": "screenshot.png",
"target_language": "English",
"source_hint": "auto"
}
r = requests.post(f"{BASE}/screenshot/translate", json=payload)
print(r.json())
def screenshot_to_text_model():
payload = {
"image_path": "screenshot.png",
"target_language": "English",
"user_task": "Explain what this screenshot says and what action I should take."
}
r = requests.post(f"{BASE}/screenshot/ask", json=payload)
print(r.json())
if __name__ == "__main__":
health()
unload_vision()
load_7b()
ask_text()