Update app.py
Browse files
app.py
CHANGED
|
@@ -79,7 +79,7 @@ def transcribe(audio, text):
|
|
| 79 |
|
| 80 |
# Upload the chat transcript to Notion
|
| 81 |
df = pd.DataFrame([chat_transcript])
|
| 82 |
-
notion_df.upload(df, 'https://www.notion.so/
|
| 83 |
|
| 84 |
# Reset the messages list and answer counter
|
| 85 |
messages = [initial_message]
|
|
@@ -107,9 +107,9 @@ def transcribe(audio, text):
|
|
| 107 |
# Concatenate the chat history
|
| 108 |
chat_transcript = "\n\n".join([f"[ANSWER {answer_count}]{message['role']}: {message['content']}" for message in messages if message['role'] != 'system'])
|
| 109 |
|
| 110 |
-
chat_transcript_copy = chat_transcript
|
| 111 |
# Append the number of tokens used to the end of the chat transcript
|
| 112 |
-
|
| 113 |
|
| 114 |
# Save the chat transcript to a file
|
| 115 |
with open("conversation_history.txt", "a") as f:
|
|
@@ -118,11 +118,11 @@ def transcribe(audio, text):
|
|
| 118 |
# Upload the chat transcript to Notion
|
| 119 |
now_et = datetime.now(timezone(timedelta(hours=-5)))
|
| 120 |
published_date = now_et.strftime('%m-%d-%y %H:%M')
|
| 121 |
-
df = pd.DataFrame([
|
| 122 |
-
notion_df.upload(df, 'https://www.notion.so/
|
| 123 |
|
| 124 |
# Return the chat transcript
|
| 125 |
-
return
|
| 126 |
|
| 127 |
# Define the input and output components for Gradio
|
| 128 |
audio_input = Audio(source="microphone", type="filepath", label="Record your message")
|
|
|
|
| 79 |
|
| 80 |
# Upload the chat transcript to Notion
|
| 81 |
df = pd.DataFrame([chat_transcript])
|
| 82 |
+
notion_df.upload(df, 'https://www.notion.so/YENA-be569d0a40c940e7b6e0679318215790?pvs=4', title=str(published_date+'back_up'), api_key=API_KEY)
|
| 83 |
|
| 84 |
# Reset the messages list and answer counter
|
| 85 |
messages = [initial_message]
|
|
|
|
| 107 |
# Concatenate the chat history
|
| 108 |
chat_transcript = "\n\n".join([f"[ANSWER {answer_count}]{message['role']}: {message['content']}" for message in messages if message['role'] != 'system'])
|
| 109 |
|
| 110 |
+
# chat_transcript_copy = chat_transcript
|
| 111 |
# Append the number of tokens used to the end of the chat transcript
|
| 112 |
+
chat_transcript += f"\n\nNumber of tokens used: {num_tokens}\n\n"
|
| 113 |
|
| 114 |
# Save the chat transcript to a file
|
| 115 |
with open("conversation_history.txt", "a") as f:
|
|
|
|
| 118 |
# Upload the chat transcript to Notion
|
| 119 |
now_et = datetime.now(timezone(timedelta(hours=-5)))
|
| 120 |
published_date = now_et.strftime('%m-%d-%y %H:%M')
|
| 121 |
+
df = pd.DataFrame([chat_transcript])
|
| 122 |
+
notion_df.upload(df, 'https://www.notion.so/YENA-be569d0a40c940e7b6e0679318215790?pvs=4', title=str(published_date), api_key=API_KEY)
|
| 123 |
|
| 124 |
# Return the chat transcript
|
| 125 |
+
return system_message
|
| 126 |
|
| 127 |
# Define the input and output components for Gradio
|
| 128 |
audio_input = Audio(source="microphone", type="filepath", label="Record your message")
|