Spaces:
Sleeping
Sleeping
Commit
·
61de4ef
1
Parent(s):
8ea78d7
Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,7 @@ def generate_recipe(user_inputs):
|
|
111 |
|
112 |
def on_copy_click(text):
|
113 |
st.session_state.copied.append(text)
|
114 |
-
|
115 |
st.toast(f"Copied to clipboard!", icon='✅' )
|
116 |
|
117 |
def create_safe_filename(recipe_name):
|
@@ -213,7 +213,7 @@ if st.session_state.gpt_response is not None:
|
|
213 |
recipe_md += f"{instruction['step_number']}. {instruction['instruction']} \n"
|
214 |
recipe['md'] = recipe_md
|
215 |
st.markdown(recipe_md)
|
216 |
-
|
217 |
# write to file
|
218 |
# filename = create_safe_filename(recipe["name"])
|
219 |
# with open(f"/data/generated/{filename}.json", "w") as f:
|
|
|
111 |
|
112 |
def on_copy_click(text):
|
113 |
st.session_state.copied.append(text)
|
114 |
+
pyperclip.copy(text)
|
115 |
st.toast(f"Copied to clipboard!", icon='✅' )
|
116 |
|
117 |
def create_safe_filename(recipe_name):
|
|
|
213 |
recipe_md += f"{instruction['step_number']}. {instruction['instruction']} \n"
|
214 |
recipe['md'] = recipe_md
|
215 |
st.markdown(recipe_md)
|
216 |
+
st.button("Copy to Clipboard", on_click=on_copy_click, args=(recipe_md,))
|
217 |
# write to file
|
218 |
# filename = create_safe_filename(recipe["name"])
|
219 |
# with open(f"/data/generated/{filename}.json", "w") as f:
|