son9john commited on
Commit
a046b3b
·
1 Parent(s): b62a22a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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/page-827360c361f347f7bfefcc6dfbd10e51', title=str(published_date+'back_up'), api_key=API_KEY)
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
- chat_transcript_copy += 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,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([chat_transcript_copy])
122
- notion_df.upload(df, 'https://www.notion.so/page-827360c361f347f7bfefcc6dfbd10e51', title=str(published_date), api_key=API_KEY)
123
 
124
  # Return the chat transcript
125
- return chat_transcript
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")