-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathquick_start.py
More file actions
30 lines (27 loc) · 959 Bytes
/
Copy pathquick_start.py
File metadata and controls
30 lines (27 loc) · 959 Bytes
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
# -*- encoding: utf-8 -*-
'''
@File : quick_start.py
@Time : 2023/01/16 23:15:11
@Author : Chuhao Jin
@Email : jinchuhao@ruc.edu.cn
'''
# here put the import lib
import time, json, requests
timestamp = time.strftime('%Y%m%d%H%M%S',time.localtime(time.time()))
input_text_elements = {
"sentences": [
["CHILDREN'S DAY", 90], # [text, font_size]
["Children are The Future of Nation", 50] # [text, font_size]
],
"background_query": "Children's Day!" # sentence used to retrieve background images.
}
input_text_elements = json.dumps(input_text_elements)
api_url = "http://bl.mmd.ac.cn:8889/text2poster"
response = requests.get(api_url, params = {"input_text_elements": input_text_elements})
if response.status_code == 200:
f = open("poster-{}.jpg".format(timestamp), "wb")
f.write(response.content)
f.close()
print("Save poster to:", "poster-{}.jpg".format(timestamp))
else:
print(response.text)