Spaces:
Runtime error
Runtime error
Commit
·
ea0e302
1
Parent(s):
df8f622
Update app.py
Browse files
app.py
CHANGED
@@ -3,13 +3,13 @@ import gradio as gr
|
|
3 |
def generate_ielts_essay(prompt):
|
4 |
# You may want to customize the max_length and other parameters according to your needs
|
5 |
return "Hello " + prompt + "!!"
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
def respond(message, band, chat_history, instruction, temperature=0.7):
|
15 |
prompt = format_chat_prompt(message, band, chat_history, instruction)
|
|
|
3 |
def generate_ielts_essay(prompt):
|
4 |
# You may want to customize the max_length and other parameters according to your needs
|
5 |
return "Hello " + prompt + "!!"
|
6 |
+
def format_chat_prompt(message, band, chat_history, instruction):
|
7 |
+
prompt = f"System:{instruction}"
|
8 |
+
for turn in chat_history:
|
9 |
+
user_message, bot_message = turn
|
10 |
+
prompt = f"{prompt}\nUser: {user_message}\nAssistant: {bot_message}"
|
11 |
+
prompt = f"{prompt}\nUser: IELTS Writing Band {band} - {message}\nAssistant:"
|
12 |
+
return prompt
|
13 |
|
14 |
def respond(message, band, chat_history, instruction, temperature=0.7):
|
15 |
prompt = format_chat_prompt(message, band, chat_history, instruction)
|