From 6f75eca0c212cc5242bf787d8f9fdef2b69b4c57 Mon Sep 17 00:00:00 2001
From: clr-li <111320104+clr-li@users.noreply.github.com>
Date: Fri, 26 Jan 2024 13:15:03 -0800
Subject: [PATCH] Regen button appears once
---
daras_ai_v2/base.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/daras_ai_v2/base.py b/daras_ai_v2/base.py
index 75068f911..28756f96a 100644
--- a/daras_ai_v2/base.py
+++ b/daras_ai_v2/base.py
@@ -1514,6 +1514,13 @@ def clear_outputs(self):
st.session_state.pop(field_name, None)
def _render_after_output(self):
+ if "seed" in self.RequestModel.schema_json():
+ randomize = st.button(
+ ' Regenerate', type="tertiary"
+ )
+ if randomize:
+ st.session_state[StateKeys.pressed_randomize] = True
+ st.experimental_rerun()
caption = ""
caption += f'\\\nGenerated in {st.session_state.get(StateKeys.run_time, 0):.2f}s'
if "seed" in self.RequestModel.schema_json():
@@ -1534,13 +1541,6 @@ def render_buttons(self, url: str):
url=url,
type="secondary",
)
- if "seed" in self.RequestModel.schema_json():
- randomize = st.button(
- ' Regenerate', type="tertiary"
- )
- if randomize:
- st.session_state[StateKeys.pressed_randomize] = True
- st.experimental_rerun()
self._render_report_button()
def state_to_doc(self, state: dict):