IshmamF commited on
Commit
ac7f762
·
verified ·
1 Parent(s): 64e9d47

Update text2image.py

Browse files
Files changed (1) hide show
  1. text2image.py +7 -2
text2image.py CHANGED
@@ -3,12 +3,17 @@ import os
3
  import json
4
  STABLE_API = os.getenv("STABLE_API")
5
 
6
- def generate_image(location, weather, country, description):
7
  url = "https://stablediffusionapi.com/api/v3/text2img"
8
 
 
 
 
 
 
9
  payload = json.dumps({
10
  "key": STABLE_API,
11
- "prompt": f"scenary or famous landmark in {location},{country} with the weather consisting of {weather} and {description}",
12
  "negative_prompt": None,
13
  "width": "512",
14
  "height": "512",
 
3
  import json
4
  STABLE_API = os.getenv("STABLE_API")
5
 
6
+ def generate_image(location, weather, country, description, user_input, additional=""):
7
  url = "https://stablediffusionapi.com/api/v3/text2img"
8
 
9
+ if additional:
10
+ prompt = f"{additional} at {user_input} in {location},{country} with the weather consisting of {weather} and {description}"
11
+ else:
12
+ prompt = f"{user_input} in {location},{country} with the weather consisting of {weather} and {description}"
13
+
14
  payload = json.dumps({
15
  "key": STABLE_API,
16
+ "prompt": prompt,
17
  "negative_prompt": None,
18
  "width": "512",
19
  "height": "512",