File size: 570 Bytes
1e96bca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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