Spaces:
Runtime error
Runtime error
Commit
·
1e7ab47
1
Parent(s):
49fcb9b
update translate prompt
Browse files
app.py
CHANGED
|
@@ -84,11 +84,14 @@ class GPT4News():
|
|
| 84 |
def translate(self, txt, output_lang):
|
| 85 |
if output_lang == 'English':
|
| 86 |
return txt
|
| 87 |
-
system = '
|
|
|
|
| 88 |
output_lang, txt)
|
| 89 |
-
messages = [{'role': 'system', 'content': system
|
|
|
|
| 90 |
response = self.chatgpt(messages)
|
| 91 |
print(f'SYSTEM:\n\n{system}')
|
|
|
|
| 92 |
print(f'RESPONSE:\n\n{response}')
|
| 93 |
return response
|
| 94 |
|
|
|
|
| 84 |
def translate(self, txt, output_lang):
|
| 85 |
if output_lang == 'English':
|
| 86 |
return txt
|
| 87 |
+
system = 'You are a translator.'
|
| 88 |
+
user = 'Translate the following text to {}:\n\n{}'.format(
|
| 89 |
output_lang, txt)
|
| 90 |
+
messages = [{'role': 'system', 'content': system,
|
| 91 |
+
'role': 'user', 'content': user}]
|
| 92 |
response = self.chatgpt(messages)
|
| 93 |
print(f'SYSTEM:\n\n{system}')
|
| 94 |
+
print(f'USER:\n\n{user}')
|
| 95 |
print(f'RESPONSE:\n\n{response}')
|
| 96 |
return response
|
| 97 |
|