HoangHa commited on
Commit
6ad20d2
1 Parent(s): 7e34442

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -7
app.py CHANGED
@@ -127,13 +127,33 @@ for message in st.session_state.messages:
127
  with st.chat_message(message["role"]):
128
  st.markdown(message["content"])
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  # User Input and AI Response
132
  # For "Chat mode"
133
  if user_input_type == "Chat":
134
  if prompt := st.chat_input("What is up?"):
135
  # System
136
- st.session_state.messages.append({"role": "system", "content": "You are a helpful assistant named Jarvis"})
137
 
138
  # User
139
  st.session_state.messages.append({"role": "user", "content": prompt})
@@ -152,9 +172,9 @@ if user_input_type == "Chat":
152
  ],
153
  temperature=temperature, # Set temperature
154
  max_tokens=max_tokens, # Set max tokens
155
- top_p=top_p, # Set top p
156
- frequency_penalty=frequency_penalty, # Set frequency penalty
157
- presence_penalty=presence_penalty, # Set presence penalty
158
  stream=True,
159
  ):
160
  full_response += response.choices[0].delta.get("content", "")
@@ -191,9 +211,9 @@ elif user_input_type == "Record Audio":
191
  ],
192
  temperature=temperature, # Set temperature
193
  max_tokens=max_tokens, # Set max tokens
194
- top_p=top_p, # Set top p
195
- frequency_penalty=frequency_penalty, # Set frequency penalty
196
- presence_penalty=presence_penalty, # Set presence penalty
197
  stream=True,
198
  ):
199
  full_response += response.choices[0].delta.get("content", "")
 
127
  with st.chat_message(message["role"]):
128
  st.markdown(message["content"])
129
 
130
+ system_text="""As a helpful, thoughtful, and wise IELTS instructor responsible for testing Speaking Part 1. The users will provide the {subject} they want to talk about.
131
+
132
+ It's important to follow these guidelines:
133
+ - Give only original question for provided {subject}.
134
+ - Give one question at a time.
135
+
136
+ For example:
137
+ {subject}: Work
138
+ What is your job?
139
+ Where do you work?
140
+
141
+ {subject}: Study
142
+ What do you study?
143
+ Where do you study that?
144
+
145
+ {subject}: Hometown
146
+ Do you live in a house or a flat?
147
+ How are the walls decorated?
148
+
149
+ Let's start the test."""
150
 
151
  # User Input and AI Response
152
  # For "Chat mode"
153
  if user_input_type == "Chat":
154
  if prompt := st.chat_input("What is up?"):
155
  # System
156
+ st.session_state.messages.append({"role": "system", "content": system_text})
157
 
158
  # User
159
  st.session_state.messages.append({"role": "user", "content": prompt})
 
172
  ],
173
  temperature=temperature, # Set temperature
174
  max_tokens=max_tokens, # Set max tokens
175
+ # top_p=top_p, # Set top p
176
+ # frequency_penalty=frequency_penalty, # Set frequency penalty
177
+ # presence_penalty=presence_penalty, # Set presence penalty
178
  stream=True,
179
  ):
180
  full_response += response.choices[0].delta.get("content", "")
 
211
  ],
212
  temperature=temperature, # Set temperature
213
  max_tokens=max_tokens, # Set max tokens
214
+ # top_p=top_p, # Set top p
215
+ # frequency_penalty=frequency_penalty, # Set frequency penalty
216
+ # presence_penalty=presence_penalty, # Set presence penalty
217
  stream=True,
218
  ):
219
  full_response += response.choices[0].delta.get("content", "")