Rathapoom commited on
Commit
511dc51
·
verified ·
1 Parent(s): 854f88d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -17,15 +17,16 @@ if st.button("Generate Questions"):
17
  if user_input:
18
  # Call OpenAI's Chat Completion API using the new structure
19
  response = client.chat.completions.create(
20
- model="gpt-4o-mini", # Or use "gpt-4" if available
21
  messages=[
22
  {"role": "system", "content": "You are a helpful assistant for generating exam questions."},
23
  {"role": "user", "content": f"Generate exam questions from the following material: {user_input}"}
24
  ]
25
  )
26
 
27
- # Extract the response and display it
28
  st.write("Generated Exam Questions:")
29
- st.write(response.choices[0].message['content'])
30
  else:
31
  st.warning("Please enter the knowledge material.")
 
 
17
  if user_input:
18
  # Call OpenAI's Chat Completion API using the new structure
19
  response = client.chat.completions.create(
20
+ model="gpt-3.5-turbo", # Or use "gpt-4" if available
21
  messages=[
22
  {"role": "system", "content": "You are a helpful assistant for generating exam questions."},
23
  {"role": "user", "content": f"Generate exam questions from the following material: {user_input}"}
24
  ]
25
  )
26
 
27
+ # Extract the response and display it correctly
28
  st.write("Generated Exam Questions:")
29
+ st.write(response.choices[0].message.content) # Access message content directly
30
  else:
31
  st.warning("Please enter the knowledge material.")
32
+