fix craft story btn
Browse files
app.py
CHANGED
|
@@ -52,6 +52,7 @@ def craft_story_from_recipe(input_str: str, recipe: str) -> None:
|
|
| 52 |
if response.status_code == 200:
|
| 53 |
st.session_state.story = response.json()["output"]["story"]
|
| 54 |
else:
|
|
|
|
| 55 |
raise ValueError("An error occurred while crafting the story.")
|
| 56 |
|
| 57 |
|
|
@@ -108,12 +109,14 @@ if check_input:
|
|
| 108 |
with choice_1:
|
| 109 |
recipe_1 = st.button(
|
| 110 |
recipe_choices["recipe"],
|
| 111 |
-
on_click=
|
|
|
|
| 112 |
)
|
| 113 |
with choice_2:
|
| 114 |
recipe_2 = st.button(
|
| 115 |
recipe_choices["second_recipe"],
|
| 116 |
-
on_click=
|
|
|
|
| 117 |
)
|
| 118 |
_other_choices = [
|
| 119 |
recipe
|
|
@@ -124,7 +127,8 @@ if check_input:
|
|
| 124 |
with other_choices[idx]:
|
| 125 |
other_recipe = st.button(
|
| 126 |
recipe,
|
| 127 |
-
on_click=
|
|
|
|
| 128 |
)
|
| 129 |
|
| 130 |
if "story" in st.session_state:
|
|
|
|
| 52 |
if response.status_code == 200:
|
| 53 |
st.session_state.story = response.json()["output"]["story"]
|
| 54 |
else:
|
| 55 |
+
print(response.json())
|
| 56 |
raise ValueError("An error occurred while crafting the story.")
|
| 57 |
|
| 58 |
|
|
|
|
| 109 |
with choice_1:
|
| 110 |
recipe_1 = st.button(
|
| 111 |
recipe_choices["recipe"],
|
| 112 |
+
on_click=craft_story_from_recipe(),
|
| 113 |
+
kwargs={"input_str": input_str, "recipe": recipe_choices["recipe"]}
|
| 114 |
)
|
| 115 |
with choice_2:
|
| 116 |
recipe_2 = st.button(
|
| 117 |
recipe_choices["second_recipe"],
|
| 118 |
+
on_click=craft_story_from_recipe(),
|
| 119 |
+
kwargs={"input_str": input_str, "recipe": recipe_choices["second_recipe"]}
|
| 120 |
)
|
| 121 |
_other_choices = [
|
| 122 |
recipe
|
|
|
|
| 127 |
with other_choices[idx]:
|
| 128 |
other_recipe = st.button(
|
| 129 |
recipe,
|
| 130 |
+
on_click=craft_story_from_recipe(),
|
| 131 |
+
kwargs={"input_str": input_str, "recipe": recipe}
|
| 132 |
)
|
| 133 |
|
| 134 |
if "story" in st.session_state:
|