Spaces:
Sleeping
Sleeping
Commit ·
3bd97c2
1
Parent(s): 21c05be
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,11 +135,13 @@ def reset_textbox():
|
|
| 135 |
|
| 136 |
def random_sample():
|
| 137 |
global SAMPLE_IDX
|
| 138 |
-
SAMPLE_IDX = random.
|
|
|
|
| 139 |
image = np.array(Image.open(os.path.join(os.path.dirname(__file__), "data/Court.jpeg")))
|
| 140 |
random_characters = [Image.open(os.path.join(os.path.dirname(__file__), f'data/characters_{idx:02}.png')).resize((64, 64)) for idx in SAMPLE_IDX]
|
| 141 |
global CURRENT_POSITION
|
| 142 |
-
CURRENT_POSITION = random.
|
|
|
|
| 143 |
new_image = Image.fromarray(image).convert('RGBA')
|
| 144 |
for k in range(TOTAL_K):
|
| 145 |
new_image.paste(random_characters[k], CURRENT_POSITION[k], random_characters[k])
|
|
|
|
| 135 |
|
| 136 |
def random_sample():
|
| 137 |
global SAMPLE_IDX
|
| 138 |
+
SAMPLE_IDX = list(np.random.choice(range(25), TOTAL_K, replace = False))
|
| 139 |
+
# SAMPLE_IDX = random.choices(range(25), k=TOTAL_K)
|
| 140 |
image = np.array(Image.open(os.path.join(os.path.dirname(__file__), "data/Court.jpeg")))
|
| 141 |
random_characters = [Image.open(os.path.join(os.path.dirname(__file__), f'data/characters_{idx:02}.png')).resize((64, 64)) for idx in SAMPLE_IDX]
|
| 142 |
global CURRENT_POSITION
|
| 143 |
+
CURRENT_POSITION = list(np.random.choice(RANDOM_POSITION, k = TOTAL_K, replace = False))
|
| 144 |
+
# CURRENT_POSITION = random.choices(RANDOM_POSITION, k = TOTAL_K)
|
| 145 |
new_image = Image.fromarray(image).convert('RGBA')
|
| 146 |
for k in range(TOTAL_K):
|
| 147 |
new_image.paste(random_characters[k], CURRENT_POSITION[k], random_characters[k])
|