Spaces:
Running
Running
drakosfire
commited on
Commit
•
7f3a0c1
1
Parent(s):
f26612a
added explicit pathing based on os.path for static files
Browse files- __pycache__/card_generator.cpython-310.pyc +0 -0
- card_generator.py +9 -4
- utilities.py +7 -6
__pycache__/card_generator.cpython-310.pyc
CHANGED
Binary files a/__pycache__/card_generator.cpython-310.pyc and b/__pycache__/card_generator.cpython-310.pyc differ
|
|
card_generator.py
CHANGED
@@ -13,11 +13,16 @@ def save_image(image,item_key):
|
|
13 |
#shop_inventory = inv.inventory
|
14 |
#purchased_item_key = shop_inventory['Shortsword']
|
15 |
#border_path = './card_templates/Shining Sunset Border.png'
|
16 |
-
|
17 |
-
|
18 |
-
blank_overlay_path = "./card_parts/white-fill-title-detail-value-transparent.png"
|
19 |
-
value_overlay_path = "./card_parts/Value_box_transparent.png"
|
20 |
test_item = {'Name': 'Pustulent Raspberry', 'Type': 'Fruit', 'Value': '1 cp', 'Properties': ['Unusual Appearance', 'Rare Taste'], 'Weight': '0.2 lb', 'Description': 'This small fruit has a pustulent appearance, with bumps and irregular shapes covering its surface. Its vibrant colors and strange texture make it an oddity among other fruits.', 'Quote': 'A fruit that defies expectations, as sweet and sour as life itself.', 'SD Prompt': 'A small fruit with vibrant colors and irregular shapes, bumps covering its surface.'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
def print_directory_structure(startpath):
|
23 |
for root, dirs, files in os.walk(startpath):
|
|
|
13 |
#shop_inventory = inv.inventory
|
14 |
#purchased_item_key = shop_inventory['Shortsword']
|
15 |
#border_path = './card_templates/Shining Sunset Border.png'
|
16 |
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
17 |
+
value_overlay_path = os.path.join(base_dir, "card_parts/Value_box_transparent.png")
|
|
|
|
|
18 |
test_item = {'Name': 'Pustulent Raspberry', 'Type': 'Fruit', 'Value': '1 cp', 'Properties': ['Unusual Appearance', 'Rare Taste'], 'Weight': '0.2 lb', 'Description': 'This small fruit has a pustulent appearance, with bumps and irregular shapes covering its surface. Its vibrant colors and strange texture make it an oddity among other fruits.', 'Quote': 'A fruit that defies expectations, as sweet and sour as life itself.', 'SD Prompt': 'A small fruit with vibrant colors and irregular shapes, bumps covering its surface.'}
|
19 |
+
sticker_path_dictionary = {'Default': os.path.join(base_dir, "card_parts/Sizzek Sticker.png"),
|
20 |
+
'Common': os.path.join(base_dir, "card_parts/card_parts/Common.png"),
|
21 |
+
'Uncommon': os.path.join(base_dir, "card_parts/card_parts/Uncommon.png"),
|
22 |
+
'Rare': os.path.join(base_dir, "card_parts/Rare.png"),
|
23 |
+
'Very Rare':os.path.join(base_dir, "card_parts/card_parts/card_parts/Very Rare.png"),
|
24 |
+
'Legendary':os.path.join(base_dir, "card_parts/Legendary.png")}
|
25 |
+
|
26 |
|
27 |
def print_directory_structure(startpath):
|
28 |
for root, dirs, files in os.walk(startpath):
|
utilities.py
CHANGED
@@ -23,13 +23,14 @@ def delete_files(file_paths):
|
|
23 |
if file_paths:
|
24 |
|
25 |
for file_path in file_paths:
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
31 |
file_paths.clear()
|
32 |
-
|
33 |
|
34 |
def open_image_from_url(image_url):
|
35 |
response = requests.get(image_url)
|
|
|
23 |
if file_paths:
|
24 |
|
25 |
for file_path in file_paths:
|
26 |
+
if file_path != ".keep":
|
27 |
+
try:
|
28 |
+
os.remove(f"./image_temp/{file_path}")
|
29 |
+
print(f"Remove : ./image_temp/{file_path}")
|
30 |
+
except OSError as e:
|
31 |
+
print(f"Error: {file_path} : {e.strerror}")
|
32 |
file_paths.clear()
|
33 |
+
|
34 |
|
35 |
def open_image_from_url(image_url):
|
36 |
response = requests.get(image_url)
|