Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,34 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
-
from pymongo import MongoClient
|
3 |
-
from bardapi import Bard
|
4 |
-
import os
|
5 |
-
from plyer import notification as nt
|
6 |
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# def notifier():
|
14 |
# nt.notify(
|
@@ -36,53 +56,53 @@ col = db["Tasks"]
|
|
36 |
# st.toast("You have a new reminder")
|
37 |
|
38 |
|
39 |
-
import streamlit as st
|
40 |
-
from datetime import datetime
|
41 |
|
42 |
-
def create_reminder(reminder_message, reminder_time):
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
def show_reminder_notification(reminder):
|
56 |
-
|
57 |
-
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
# Get the user input for the reminder message and the time to remind.
|
81 |
-
reminder_message = st.text_input("Enter reminder message:")
|
82 |
-
reminder_time = st.time_input("Enter reminder time:")
|
83 |
|
84 |
-
# Create a reminder object.
|
85 |
-
reminder = create_reminder(reminder_message, reminder_time)
|
86 |
|
87 |
-
# Show the reminder notification at the specified time.
|
88 |
-
show_reminder_notification(reminder)
|
|
|
1 |
+
import google.generativeai as palm
|
2 |
import streamlit as st
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
# Set your API key
|
5 |
+
palm.configure(api_key='PALM_KEY')
|
6 |
|
7 |
+
# Select the PaLM 2 model
|
8 |
+
model = 'models/text-bison-001'
|
9 |
+
|
10 |
+
# Generate text
|
11 |
+
prompt = "Write a poem about a cat."
|
12 |
+
completion = palm.generate_text(model=model, prompt=prompt, temperature=0.5, max_output_tokens=800)
|
13 |
+
|
14 |
+
# Print the generated text
|
15 |
+
st.write(completion.result)
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
# import streamlit as st
|
22 |
+
# from pymongo import MongoClient
|
23 |
+
# from bardapi import Bard
|
24 |
+
# import os
|
25 |
+
# from plyer import notification as nt
|
26 |
+
|
27 |
+
|
28 |
+
# uri = os.environ["MONGO_CONNECTION_STRING"]
|
29 |
+
# client = MongoClient(uri, tlsCertificateKeyFile= "files/cert.pem")
|
30 |
+
# db = client["Cosmo"]
|
31 |
+
# col = db["Tasks"]
|
32 |
|
33 |
# def notifier():
|
34 |
# nt.notify(
|
|
|
56 |
# st.toast("You have a new reminder")
|
57 |
|
58 |
|
59 |
+
# import streamlit as st
|
60 |
+
# from datetime import datetime
|
61 |
|
62 |
+
# def create_reminder(reminder_message, reminder_time):
|
63 |
+
# # Create a reminder object.
|
64 |
+
# reminder = {
|
65 |
+
# "message": reminder_message,
|
66 |
+
# "time": reminder_time
|
67 |
+
# }
|
68 |
|
69 |
+
# # Store the reminder in a database.
|
70 |
+
# # ...
|
71 |
|
72 |
+
# # Return the reminder object.
|
73 |
+
# return reminder
|
74 |
|
75 |
+
# def show_reminder_notification(reminder):
|
76 |
+
# # Calculate the time difference between the current time and the reminder time.
|
77 |
+
# time_diff = reminder["time"] - datetime.now()
|
78 |
|
79 |
+
# # If the time difference is less than or equal to 0, then show the reminder notification.
|
80 |
+
# if time_diff <= 0:
|
81 |
+
# # Create a Streamlit toast message.
|
82 |
+
# toast = st.toast(reminder["message"], icon="ℹ️")
|
83 |
|
84 |
+
# # Add buttons to the toast message to track the reminder as done or notdone.
|
85 |
+
# done_button = st.button("Done")
|
86 |
+
# notdone_button = st.button("Not done")
|
87 |
|
88 |
+
# # If the done button is pressed, then mark the reminder as done.
|
89 |
+
# if done_button:
|
90 |
+
# # Update the reminder in the database as done.
|
91 |
+
# # ...
|
92 |
|
93 |
+
# # Close the toast message.
|
94 |
+
# toast.close()
|
95 |
|
96 |
+
# # If the notdone button is pressed, then dismiss the toast message.
|
97 |
+
# elif notdone_button:
|
98 |
+
# toast.close()
|
99 |
|
100 |
+
# # Get the user input for the reminder message and the time to remind.
|
101 |
+
# reminder_message = st.text_input("Enter reminder message:")
|
102 |
+
# reminder_time = st.time_input("Enter reminder time:")
|
103 |
|
104 |
+
# # Create a reminder object.
|
105 |
+
# reminder = create_reminder(reminder_message, reminder_time)
|
106 |
|
107 |
+
# # Show the reminder notification at the specified time.
|
108 |
+
# show_reminder_notification(reminder)
|