Spaces:
Runtime error
Runtime error
File size: 1,811 Bytes
9b674e9 |
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 |
import requests
import time
class Remote_Client:
def __init__(self, url):
self.url = url
def send_request(self, path, data):
response = requests.post(self.url+path, json=data)
return response.json()
def input(self, text:str, screen:bool=False, talk:bool=False) -> str:
data = {"text": text, "screen": str(screen).lower(), "talk": str(talk).lower()}
response = self.send_request("/input", data)
return response["response"]
def just_screenshot(self) -> str:
data = {}
response = self.send_request("/screenshot", data)
return response["response"]
def talk(self, text:str) -> str:
data = {"text": text}
response = self.send_request("/tts", data)
return response["response"]
def profile(self, profile:str) -> str:
data = {"profile": profile}
response = self.send_request("/profile", data)
return response["response"]
def reset_memory(self) -> str:
response = self.send_request("/reset_memory", {})
return response["response"]
def enable_predefined_agents(self) -> str:
response = self.send_request("/activate_predefined_agents", {})
return response["response"]
def disable_predefined_agents(self) -> str:
response = self.send_request("/deactivate_predefined_agents", {})
return response["response"]
def enable_online_tools(self) -> str:
response = self.send_request("/activate_online_tools", {})
return response["response"]
def disable_online_tools(self) -> str:
response = self.send_request("/deactivate_online_tools", {})
return response["response"]
def wait(self, second):
time.sleep(second)
remote = Remote_Client("http://localhost:7541")
|