Update app.py
Browse files
app.py
CHANGED
|
@@ -285,39 +285,16 @@ def post_to_linkedin(access_token, reflection, visibility="PUBLIC"):
|
|
| 285 |
except Exception as e:
|
| 286 |
return f"Error posting to LinkedIn: {str(e)}"
|
| 287 |
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
for idea in ideas:
|
| 299 |
-
if idea.strip():
|
| 300 |
-
ideas_db.append({"content": idea.strip(), "timestamp": datetime.now()})
|
| 301 |
-
return [idea["content"] for idea in ideas_db]
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
# In[35]:
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
### Curify Projects ###
|
| 308 |
-
def prepare_meeting(json_input):
|
| 309 |
-
try:
|
| 310 |
-
meetings = json.loads(json_input)
|
| 311 |
-
preparations = []
|
| 312 |
-
for meeting in meetings:
|
| 313 |
-
title = meeting.get("title", "No Title")
|
| 314 |
-
time = meeting.get("time", "No Time")
|
| 315 |
-
description = meeting.get("description", "No Description")
|
| 316 |
-
preparations.append(f"Meeting: {title}\nTime: {time}\nDetails: {description}")
|
| 317 |
-
return "\n\n".join(preparations)
|
| 318 |
-
except Exception as e:
|
| 319 |
-
return f"Error processing input: {e}"
|
| 320 |
-
|
| 321 |
|
| 322 |
# In[36]:
|
| 323 |
|
|
@@ -348,7 +325,16 @@ with gr.Blocks() as demo:
|
|
| 348 |
with gr.Column():
|
| 349 |
reflection_btn = gr.Button("Generate reflection")
|
| 350 |
reflection_output = gr.Textbox(label="Reflections", lines=5)
|
| 351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
fetch_btn.click(
|
| 353 |
process_webpage,
|
| 354 |
inputs=url_input,
|
|
@@ -367,7 +353,7 @@ with gr.Blocks() as demo:
|
|
| 367 |
outputs=reflection_output,
|
| 368 |
)
|
| 369 |
|
| 370 |
-
demo.launch(share=True)
|
| 371 |
|
| 372 |
|
| 373 |
# In[ ]:
|
|
|
|
| 285 |
except Exception as e:
|
| 286 |
return f"Error posting to LinkedIn: {str(e)}"
|
| 287 |
|
| 288 |
+
# JavaScript for copying text to the clipboard
|
| 289 |
+
copy_to_clipboard_js = """
|
| 290 |
+
function copyToClipboard(text) {
|
| 291 |
+
navigator.clipboard.writeText(text).then(() => {
|
| 292 |
+
alert("Text copied to clipboard!");
|
| 293 |
+
}).catch(err => {
|
| 294 |
+
alert("Failed to copy text: " + err);
|
| 295 |
+
});
|
| 296 |
+
}
|
| 297 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
|
| 299 |
# In[36]:
|
| 300 |
|
|
|
|
| 325 |
with gr.Column():
|
| 326 |
reflection_btn = gr.Button("Generate reflection")
|
| 327 |
reflection_output = gr.Textbox(label="Reflections", lines=5)
|
| 328 |
+
copy_btn = gr.Button("Copy to clipboard")
|
| 329 |
+
|
| 330 |
+
# Connect the button to the JS function for copying
|
| 331 |
+
copy_btn.click(
|
| 332 |
+
None,
|
| 333 |
+
inputs=[reflection_output],
|
| 334 |
+
outputs=[],
|
| 335 |
+
_js=f"copyToClipboard"
|
| 336 |
+
)
|
| 337 |
+
|
| 338 |
fetch_btn.click(
|
| 339 |
process_webpage,
|
| 340 |
inputs=url_input,
|
|
|
|
| 353 |
outputs=reflection_output,
|
| 354 |
)
|
| 355 |
|
| 356 |
+
demo.launch(share=True, custom_js=copy_to_clipboard_js)
|
| 357 |
|
| 358 |
|
| 359 |
# In[ ]:
|