simonraj commited on
Commit
8744387
·
1 Parent(s): 4d64936

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -21,19 +21,17 @@ def predict(question_choice, audio):
21
  message = transcript["text"] # This is the transcribed message from the audio input
22
 
23
  # Generate the system message based on the chosen question
24
- current_question_index = HongWenData.questions.index(question_choice)
25
- strategy, explanation = HongWenData.strategy_text[current_question_index]
26
 
27
  # Construct the conversation with the system and user's message
28
  conversation = [
29
  {
30
  "role": "system",
31
- "content": f"You are an expert English Language Teacher in a Singapore Primary school, directly guiding a Primary 6 student in Singapore. The student is answering the question: '{HongWenData.questions[current_question_index]}'. Point out areas they did well and where they can improve. Then, provide a suggested response using the {HongWenData.strategy_text[current_question_index][0]} strategy. Encourage the use of sophisticated vocabulary and expressions. For the second and third questions, the picture is not relevant, so the student should not refer to it in their response. {explanation} The feedback should be in second person, addressing the student directly."
32
  },
33
  {"role": "user", "content": message}
34
  ]
35
 
36
-
37
  response = openai.ChatCompletion.create(
38
  model='gpt-3.5-turbo',
39
  messages=conversation,
@@ -48,11 +46,6 @@ def predict(question_choice, audio):
48
  partial_message = partial_message + chunk['choices'][0]['delta']['content']
49
  yield partial_message
50
 
51
-
52
- def get_image_html():
53
- return "![](HongWenSBC.JPG)" # Markdown syntax to embed the image
54
-
55
-
56
  # Gradio Interface
57
  iface = gr.Interface(
58
  fn=predict,
@@ -66,3 +59,4 @@ iface = gr.Interface(
66
  )
67
  iface.queue().launch()
68
 
 
 
21
  message = transcript["text"] # This is the transcribed message from the audio input
22
 
23
  # Generate the system message based on the chosen question
24
+ strategy, explanation = HongWenData.strategy_text["TREES"]
 
25
 
26
  # Construct the conversation with the system and user's message
27
  conversation = [
28
  {
29
  "role": "system",
30
+ "content": f"You are an expert English Language Teacher in a Singapore Primary school, directly guiding a Primary 6 student in Singapore. The student is answering the question: '{question_choice}'. Point out areas they did well and where they can improve. Then, provide a suggested response using the {strategy} strategy. Encourage the use of sophisticated vocabulary and expressions. For the second and third questions, the picture is not relevant, so the student should not refer to it in their response. {explanation} The feedback should be in second person, addressing the student directly."
31
  },
32
  {"role": "user", "content": message}
33
  ]
34
 
 
35
  response = openai.ChatCompletion.create(
36
  model='gpt-3.5-turbo',
37
  messages=conversation,
 
46
  partial_message = partial_message + chunk['choices'][0]['delta']['content']
47
  yield partial_message
48
 
 
 
 
 
 
49
  # Gradio Interface
50
  iface = gr.Interface(
51
  fn=predict,
 
59
  )
60
  iface.queue().launch()
61
 
62
+