Update app.py
Browse files
app.py
CHANGED
|
@@ -96,9 +96,9 @@ def transcribe(audio, text):
|
|
| 96 |
messages.append({"role": "user", "content": input_text})
|
| 97 |
|
| 98 |
# Get the current date and time in the local timezone
|
| 99 |
-
now_local = datetime.
|
| 100 |
# Create a timezone object for Eastern Time (ET)
|
| 101 |
-
et_tz =
|
| 102 |
# Adjust the date and time to Eastern Time (ET)
|
| 103 |
now_et = now_local.astimezone(et_tz)
|
| 104 |
|
|
@@ -121,13 +121,10 @@ def transcribe(audio, text):
|
|
| 121 |
eastern_time = utc_time + timedelta(hours=-5)
|
| 122 |
# Format as string (YY-MM-DD HH:MM)
|
| 123 |
published_date = eastern_time.strftime('%m-%d-%y %H:%M')
|
| 124 |
-
|
| 125 |
-
import pandas as pd
|
| 126 |
# string dataframe?
|
| 127 |
df = pd.DataFrame([chat_transcript])
|
| 128 |
-
notion_df.upload(df, 'https://www.notion.so/page-827360c361f347f7bfefcc6dfbd10e51', title=str(published_date
|
| 129 |
|
| 130 |
-
|
| 131 |
if num_tokens > 2200:
|
| 132 |
# Reset the messages list and answer counter
|
| 133 |
messages = [initial_message]
|
|
@@ -159,7 +156,7 @@ def transcribe(audio, text):
|
|
| 159 |
|
| 160 |
chat_transcript_copy = chat_transcript
|
| 161 |
chat_transcript_copy += f"Number of tokens used: {num_tokens}\n\n"
|
| 162 |
-
filename = datetime.
|
| 163 |
|
| 164 |
# dbx.files_upload(chat_transcript_copy.encode('utf-8'), f'/{filename}', mode=dropbox.files.WriteMode.overwrite, autorename=False, client_modified=None, mute=False)
|
| 165 |
# dbx.files_upload(chat_transcript_copy.encode('utf-8'), '/conversation_history.txt', mode=dropbox.files.WriteMode.overwrite, autorename=False, client_modified=None, mute=False)
|
|
@@ -170,11 +167,16 @@ def transcribe(audio, text):
|
|
| 170 |
eastern_time = utc_time + timedelta(hours=-5)
|
| 171 |
# Format as string (YY-MM-DD HH:MM)
|
| 172 |
published_date = eastern_time.strftime('%m-%d-%y %H:%M')
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
df = pd.DataFrame([chat_transcript_copy])
|
| 177 |
-
notion_df.upload(df, 'https://www.notion.so/page-827360c361f347f7bfefcc6dfbd10e51', title=str(
|
| 178 |
|
| 179 |
return chat_transcript
|
| 180 |
|
|
|
|
| 96 |
messages.append({"role": "user", "content": input_text})
|
| 97 |
|
| 98 |
# Get the current date and time in the local timezone
|
| 99 |
+
now_local = datetime.now()
|
| 100 |
# Create a timezone object for Eastern Time (ET)
|
| 101 |
+
et_tz = timezone(timedelta(hours=-5))
|
| 102 |
# Adjust the date and time to Eastern Time (ET)
|
| 103 |
now_et = now_local.astimezone(et_tz)
|
| 104 |
|
|
|
|
| 121 |
eastern_time = utc_time + timedelta(hours=-5)
|
| 122 |
# Format as string (YY-MM-DD HH:MM)
|
| 123 |
published_date = eastern_time.strftime('%m-%d-%y %H:%M')
|
|
|
|
|
|
|
| 124 |
# string dataframe?
|
| 125 |
df = pd.DataFrame([chat_transcript])
|
| 126 |
+
notion_df.upload(df, 'https://www.notion.so/page-827360c361f347f7bfefcc6dfbd10e51', title=str(published_date), api_key=API_KEY)
|
| 127 |
|
|
|
|
| 128 |
if num_tokens > 2200:
|
| 129 |
# Reset the messages list and answer counter
|
| 130 |
messages = [initial_message]
|
|
|
|
| 156 |
|
| 157 |
chat_transcript_copy = chat_transcript
|
| 158 |
chat_transcript_copy += f"Number of tokens used: {num_tokens}\n\n"
|
| 159 |
+
filename = datetime.now().strftime("%m%d%y_%H:%M_conversation_history.txt")
|
| 160 |
|
| 161 |
# dbx.files_upload(chat_transcript_copy.encode('utf-8'), f'/{filename}', mode=dropbox.files.WriteMode.overwrite, autorename=False, client_modified=None, mute=False)
|
| 162 |
# dbx.files_upload(chat_transcript_copy.encode('utf-8'), '/conversation_history.txt', mode=dropbox.files.WriteMode.overwrite, autorename=False, client_modified=None, mute=False)
|
|
|
|
| 167 |
eastern_time = utc_time + timedelta(hours=-5)
|
| 168 |
# Format as string (YY-MM-DD HH:MM)
|
| 169 |
published_date = eastern_time.strftime('%m-%d-%y %H:%M')
|
| 170 |
+
|
| 171 |
+
# Get the current UTC time
|
| 172 |
+
utc_time = datetime.now(timezone.utc)
|
| 173 |
+
# Convert to Eastern Time Zone
|
| 174 |
+
eastern_time = utc_time + timedelta(hours=-5)
|
| 175 |
+
# Format as string (YY-MM-DD HH:MM)
|
| 176 |
+
published_date = eastern_time.strftime('%m-%d-%y %H:%M')
|
| 177 |
+
# string dataframe
|
| 178 |
df = pd.DataFrame([chat_transcript_copy])
|
| 179 |
+
notion_df.upload(df, 'https://www.notion.so/page-827360c361f347f7bfefcc6dfbd10e51', title=str(published_date), api_key=API_KEY)
|
| 180 |
|
| 181 |
return chat_transcript
|
| 182 |
|