Update app.py
Browse files
app.py
CHANGED
@@ -541,6 +541,8 @@ class Game:
|
|
541 |
step = 1
|
542 |
current_state = self.get_state()
|
543 |
self.run = True
|
|
|
|
|
544 |
while self.run is True:
|
545 |
|
546 |
for event in pygame.event.get():
|
@@ -678,16 +680,14 @@ def streamlit_ui():
|
|
678 |
score = st.empty() # Usar .empty() para actualizar más tarde
|
679 |
with highscore_col:
|
680 |
high_score = st.empty() # Usar .empty() para actualizar más tarde
|
681 |
-
|
682 |
-
|
683 |
-
data = [] # Inicializa data como lista vacía
|
684 |
-
reward_chart = st.line_chart(data)
|
685 |
|
686 |
# Botón para iniciar el juego
|
687 |
if st.button('Iniciar Juego con IA'):
|
688 |
model_path = os.path.join(model_directory, selected_model_file)
|
689 |
game = Game(EPSILON_INIT, load_model=True, model_path=model_path)
|
690 |
-
game.play_auto()
|
691 |
|
692 |
# Ejecutar UI
|
693 |
streamlit_ui()
|
|
|
541 |
step = 1
|
542 |
current_state = self.get_state()
|
543 |
self.run = True
|
544 |
+
# Al final de cada episodio, actualiza la interfaz de Streamlit
|
545 |
+
st_placeholder.text(f'Escenario: {episode}, Resultado: {episode_reward}')
|
546 |
while self.run is True:
|
547 |
|
548 |
for event in pygame.event.get():
|
|
|
680 |
score = st.empty() # Usar .empty() para actualizar más tarde
|
681 |
with highscore_col:
|
682 |
high_score = st.empty() # Usar .empty() para actualizar más tarde
|
683 |
+
# Placeholder para mostrar el número de escenario y el resultado
|
684 |
+
episode_info = st.empty()
|
|
|
|
|
685 |
|
686 |
# Botón para iniciar el juego
|
687 |
if st.button('Iniciar Juego con IA'):
|
688 |
model_path = os.path.join(model_directory, selected_model_file)
|
689 |
game = Game(EPSILON_INIT, load_model=True, model_path=model_path)
|
690 |
+
game.play_auto(episode_info)
|
691 |
|
692 |
# Ejecutar UI
|
693 |
streamlit_ui()
|