Spaces:
Runtime error
Runtime error
Commit ·
4a1ebe5
1
Parent(s): afa334f
openAI
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import openai
|
|
| 6 |
client = openai.OpenAI()
|
| 7 |
def respond(message, history: list[tuple[str, str]], system_message, max_tokens, temperature, top_p):
|
| 8 |
|
|
|
|
| 9 |
messages = [{"role": "system", "content": system_message}]
|
| 10 |
for val in history:
|
| 11 |
if val[0]:
|
|
@@ -24,7 +25,7 @@ def respond(message, history: list[tuple[str, str]], system_message, max_tokens,
|
|
| 24 |
)
|
| 25 |
response = response.output_text
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
demo = gr.ChatInterface(
|
| 30 |
respond, #câu phản hồi
|
|
|
|
| 6 |
client = openai.OpenAI()
|
| 7 |
def respond(message, history: list[tuple[str, str]], system_message, max_tokens, temperature, top_p):
|
| 8 |
|
| 9 |
+
#make history
|
| 10 |
messages = [{"role": "system", "content": system_message}]
|
| 11 |
for val in history:
|
| 12 |
if val[0]:
|
|
|
|
| 25 |
)
|
| 26 |
response = response.output_text
|
| 27 |
|
| 28 |
+
yield response
|
| 29 |
|
| 30 |
demo = gr.ChatInterface(
|
| 31 |
respond, #câu phản hồi
|