Spaces:
Sleeping
Sleeping
Commit
·
c17ad66
1
Parent(s):
e855123
openAI
Browse files
app.py
CHANGED
@@ -5,12 +5,14 @@ import openai
|
|
5 |
# openai.api_key = "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"
|
6 |
client = openai.OpenAI()
|
7 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
|
|
|
8 |
resp = client.responses.create(
|
9 |
model="gpt-4.1-nano",
|
10 |
input=message
|
11 |
)
|
12 |
-
|
13 |
-
return resp.
|
14 |
|
15 |
demo = gr.ChatInterface(
|
16 |
respond, #câu phản hồi
|
|
|
5 |
# openai.api_key = "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"
|
6 |
client = openai.OpenAI()
|
7 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
8 |
+
|
9 |
+
#input
|
10 |
resp = client.responses.create(
|
11 |
model="gpt-4.1-nano",
|
12 |
input=message
|
13 |
)
|
14 |
+
|
15 |
+
return resp.output_text
|
16 |
|
17 |
demo = gr.ChatInterface(
|
18 |
respond, #câu phản hồi
|