Skip to content

Commit

Permalink
Regen button appears once
Browse files Browse the repository at this point in the history
  • Loading branch information
clr-li authored and devxpy committed Feb 12, 2024
1 parent e985052 commit 6f75eca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions daras_ai_v2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'<i class="fa-solid fa-recycle"></i> Regenerate', type="tertiary"
)
if randomize:
st.session_state[StateKeys.pressed_randomize] = True
st.experimental_rerun()
caption = ""
caption += f'\\\nGenerated in <span style="color: black;">{st.session_state.get(StateKeys.run_time, 0):.2f}s</span>'
if "seed" in self.RequestModel.schema_json():
Expand All @@ -1534,13 +1541,6 @@ def render_buttons(self, url: str):
url=url,
type="secondary",
)
if "seed" in self.RequestModel.schema_json():
randomize = st.button(
'<i class="fa-solid fa-recycle"></i> 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):
Expand Down

0 comments on commit 6f75eca

Please sign in to comment.