Spaces:
Running
Running
import requests | |
import json | |
def get_action(query_data, url, token): | |
headers = { | |
'Authorization': token, | |
'Content-Type': 'application/json' | |
} | |
data = { | |
"model": "pre-Mobile_Agent_Server_ADB_V2-2204", | |
"input": {"json_data": query_data} | |
} | |
while True: | |
try: | |
response = requests.post(url, headers=headers, data=json.dumps(data)) | |
response.json()["output"] | |
except: | |
print("Network Error:", response.json()) | |
else: | |
break | |
return response |