fix: Updated displayed info, randomizing photo from avaialable

This commit is contained in:
Jager72 2024-06-12 19:00:26 +02:00
parent dd2d0616f3
commit a2b1a1e4c0
2 changed files with 13 additions and 7 deletions

13
app.py
View File

@ -107,11 +107,10 @@ def watekDlaSciezkiAgenta():
has_visited_beer_keg = False has_visited_beer_keg = False
has_visited_coffee = False has_visited_coffee = False
adult = False adult = False
time.sleep(3) time.sleep(1.5)
while True: while True:
if len(path) > 0: if len(path) > 0:
element = path.pop(0) element = path.pop(0)
print(element)
if element == "left": if element == "left":
agent.rotate_left() agent.rotate_left()
if element == "right": if element == "right":
@ -130,9 +129,11 @@ def watekDlaSciezkiAgenta():
if not assigned: if not assigned:
random_client_data = random.choice(clients) random_client_data = random.choice(clients)
glasses = predict_image(random_client_data.zdjecie) glasses = predict_image(random_client_data.zdjecie)
print(random_client_data.zdjecie)
prediction = predict_client(random_client_data, glasses) prediction = predict_client(random_client_data, glasses)
print("\nClient data:") print("\nClient data:")
print(random_client_data) print(random_client_data)
print("Prediction (Glasses):", glasses)
print("Prediction (Adult):", prediction) print("Prediction (Adult):", prediction)
assigned = True assigned = True
@ -163,10 +164,10 @@ def watekDlaSciezkiAgenta():
if move_back: if move_back:
path.extend(move_back) path.extend(move_back)
time.sleep(1) time.sleep(0.5)
def watekDlaSciezkiKlienta(): def watekDlaSciezkiKlienta():
time.sleep(3) time.sleep(1)
while True: while True:
if len(path2) > 0: if len(path2) > 0:
element2 = path2.pop(0) element2 = path2.pop(0)
@ -185,7 +186,7 @@ def watekDlaSciezkiKlienta():
klient.przyStoliku = True klient.przyStoliku = True
klient.stolik = klient.current_cell klient.stolik = klient.current_cell
time.sleep(1) time.sleep(0.5)
path2 = klient.bfs2(klientx_target, klienty_target) path2 = klient.bfs2(klientx_target, klienty_target)
@ -247,6 +248,6 @@ while running:
agent.update(window) agent.update(window)
klient.update(window) klient.update(window)
pygame.display.update() pygame.display.update()
time.sleep(0.1) time.sleep(0.05)
pygame.quit() pygame.quit()

View File

@ -86,7 +86,12 @@ for person in root.findall('person'):
outfit = outfit_element.text if outfit_element is not None else '' outfit = outfit_element.text if outfit_element is not None else ''
image_element = person.find('Image') image_element = person.find('Image')
image = image_element.text if image_element is not None else ''
import os
import random
folder = "classes\\Jimmy_Neuron\\test"
file_list = os.listdir(folder)
image = os.path.join(folder, random.choice(file_list))
tattoo_element = person.find('Tattoo') tattoo_element = person.find('Tattoo')
tattoo = tattoo_element.text if tattoo_element is not None else '' tattoo = tattoo_element.text if tattoo_element is not None else ''