adrianpierce commited on
Commit
2439f35
·
1 Parent(s): 7508171

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -187,4 +187,30 @@ if st.session_state.gpt_response is not None:
187
  md_instructions += f"{instruction['step_number']}. {instruction['instruction']} \n"
188
  st.markdown(md_instructions)
189
  except:
190
- st.write(loaded_recipe['instructions'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  md_instructions += f"{instruction['step_number']}. {instruction['instruction']} \n"
188
  st.markdown(md_instructions)
189
  except:
190
+ st.write(loaded_recipe['instructions'])
191
+ # HTML for Share Button and Script
192
+ share_html = """
193
+ <hr>
194
+ <button id="shareButton" style="color: white; background-color: #FF2E63; border: none; border-radius: 4px; padding: 10px 20px; cursor: pointer;">Share Recipe</button>
195
+ <script>
196
+ if (navigator.share) {
197
+ document.getElementById('shareButton').addEventListener('click', async () => {
198
+ try {
199
+ const shareData = {
200
+ title: 'My Awesome Recipe',
201
+ text: 'Check out this amazing recipe!',
202
+ url: window.location.href,
203
+ };
204
+
205
+ await navigator.share(shareData);
206
+ } catch(err) {
207
+ console.error('Error sharing:', err);
208
+ }
209
+ });
210
+ } else {
211
+ console.log('Web Share API not supported');
212
+ document.getElementById('shareButton').style.display = 'none';
213
+ }
214
+ </script>
215
+ """
216
+ st.markdown(share_html, unsafe_allow_html=True)