son9john commited on
Commit
c3ffc00
·
1 Parent(s): 131f4cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -20,6 +20,7 @@ tokenizer = GPT2Tokenizer.from_pretrained('gpt2-medium')
20
  model = openai.api_key = os.environ["OPENAI_API_KEY"]
21
 
22
  # Define the initial message and messages list
 
23
  initial_message = {"role": "system", "content": 'You are a USMLE Tutor. Respond with ALWAYS layered "bullet points" (listing rather than sentences) to all input with a fun mneumonics to memorize that list. But you can answer up to 1200 words if the user requests longer response.'}
24
  messages = [initial_message]
25
  messages_rev = [initial_message]
@@ -86,6 +87,7 @@ def transcribe(audio, text):
86
  chat_transcript = ''
87
 
88
  for tokens in subinput_tokens:
 
89
  # Decode the tokens into text
90
  subinput_text = tokenizer.decode(tokens)
91
  messages.append({"role": "user", "content": transcript["text"]+str(subinput_text)})
@@ -106,7 +108,7 @@ def transcribe(audio, text):
106
  df = pd.DataFrame([chat_transcript])
107
  notion_df.upload(df, 'https://www.notion.so/US-62e861a0b35f43da8ef9a7789512b8c2?pvs=4', title=str(published_date+'FULL'), api_key=API_KEY)
108
  counter += 1
109
- messages = [{"role": "system", "content": initial_message}]
110
  messages = [{"role": "user", "content": subinput_text}]
111
  answer_count = 0
112
 
 
20
  model = openai.api_key = os.environ["OPENAI_API_KEY"]
21
 
22
  # Define the initial message and messages list
23
+ initmessage = 'You are a USMLE Tutor. Respond with ALWAYS layered "bullet points" (listing rather than sentences) to all input with a fun mneumonics to memorize that list. But you can answer up to 1200 words if the user requests longer response.'
24
  initial_message = {"role": "system", "content": 'You are a USMLE Tutor. Respond with ALWAYS layered "bullet points" (listing rather than sentences) to all input with a fun mneumonics to memorize that list. But you can answer up to 1200 words if the user requests longer response.'}
25
  messages = [initial_message]
26
  messages_rev = [initial_message]
 
87
  chat_transcript = ''
88
 
89
  for tokens in subinput_tokens:
90
+ messages.append[{"role": "user", "content": initmessage}]
91
  # Decode the tokens into text
92
  subinput_text = tokenizer.decode(tokens)
93
  messages.append({"role": "user", "content": transcript["text"]+str(subinput_text)})
 
108
  df = pd.DataFrame([chat_transcript])
109
  notion_df.upload(df, 'https://www.notion.so/US-62e861a0b35f43da8ef9a7789512b8c2?pvs=4', title=str(published_date+'FULL'), api_key=API_KEY)
110
  counter += 1
111
+ messages = [{"role": "system", "content": initmessage}]
112
  messages = [{"role": "user", "content": subinput_text}]
113
  answer_count = 0
114