Spaces:
son9john
/
Runtime error

son9john commited on
Commit
9500372
·
1 Parent(s): 94c8733

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -16,7 +16,8 @@ tokenizer = GPT2Tokenizer.from_pretrained('gpt2-medium')
16
  model = openai.api_key = os.environ["OPENAI_API_KEY"]
17
 
18
  # Define the initial message and messages list
19
- 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.'}
 
20
  messages = [initial_message]
21
  messages_rev = [initial_message]
22
 
@@ -82,9 +83,11 @@ def transcribe(audio, text):
82
  df = pd.DataFrame([chat_transcript])
83
  notion_df.upload(df, 'https://www.notion.so/US-62e861a0b35f43da8ef9a7789512b8c2?pvs=4', title=str(published_date+'FULL'), api_key=API_KEY)
84
 
85
- # Reset the messages list and answer counter
86
  messages = [initial_message]
 
87
  answer_count = 0
 
 
88
  else:
89
  # Increment the answer counter
90
  answer_count += 1
 
16
  model = openai.api_key = os.environ["OPENAI_API_KEY"]
17
 
18
  # Define the initial message and messages list
19
+ initialt = '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.'
20
+ initial_message = {"role": "system", "content": initialt}
21
  messages = [initial_message]
22
  messages_rev = [initial_message]
23
 
 
83
  df = pd.DataFrame([chat_transcript])
84
  notion_df.upload(df, 'https://www.notion.so/US-62e861a0b35f43da8ef9a7789512b8c2?pvs=4', title=str(published_date+'FULL'), api_key=API_KEY)
85
 
 
86
  messages = [initial_message]
87
+ messages.append({"role": "user", "content": initialt})
88
  answer_count = 0
89
+ # Add the input text to the messages list
90
+ messages.append({"role": "user", "content": input_text})
91
  else:
92
  # Increment the answer counter
93
  answer_count += 1