Skip to content

Commit 7c4b7a2

Browse files
committed
update
1 parent eb99219 commit 7c4b7a2

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

deepai-text-2-img.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55

66
deepai_api_key = os.getenv("DEEPAI_API_KEY")
77

8-
response = requests.post(
9-
"https://api.deepai.org/api/text2img",
10-
data={
11-
'text': 'While traveling through a dense forest, you stumble upon an ancient, overgrown path veering off from the main trail. Do you dare to explore its mysteries?',
12-
},
13-
headers={'api-key': deepai_api_key}
8+
def text_to_image(prompt: str):
9+
response = requests.post(
10+
"https://api.deepai.org/api/text2img",
11+
data={
12+
'text': prompt,
13+
},
14+
headers={'api-key': deepai_api_key}
1415
)
1516
print(response.json())
17+
18+
19+
def main():
20+
prompt = 'While traveling through a dense forest, you stumble upon an ancient, overgrown path veering off from the main trail. Do you dare to explore its mysteries?'
21+
image_url = text_to_image(prompt)
22+
23+
24+
if __name__ == '__main__':
25+
main()

0 commit comments

Comments
 (0)