-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathutil.py
More file actions
38 lines (28 loc) · 1.06 KB
/
util.py
File metadata and controls
38 lines (28 loc) · 1.06 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
import json
import requests
def dreamMachineMake(prompt, access_token):
url = "https://internal-api.virginia.labs.lumalabs.ai/api/photon/v1/generations/"
payload = {
"user_prompt": prompt,
"aspect_ratio": "16:9",
"expand_prompt": True
}
headers = {
"Cookie": "access_token=" + access_token,
"Origin": "https://lumalabs.ai",
"Referer": "https://lumalabs.ai",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
# 定义刷新获取结果的异步函数
async def refreshDreamMachine(session, access_token):
url = "https://internal-api.virginia.labs.lumalabs.ai/api/photon/v1/user/generations/"
querystring = {"offset": "0", "limit": "10"}
headers = {
"Cookie": "access_token=" + access_token,
}
async with session.get(url, headers=headers, params=querystring) as response:
response_text = await response.text()
response_json = json.loads(response_text)
return response_json