Spaces:
Runtime error
Runtime error
psw protect.
Browse files
app.py
CHANGED
@@ -10,22 +10,23 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
10 |
# print("key", openai.api_key)
|
11 |
|
12 |
start_sequence = "\nAI:"
|
13 |
-
restart_sequence = "\nMe:
|
14 |
|
15 |
prompt = "Start by typing example content. Then use `Me:` or `AI:` with some clue to train model...\n\nMe: Hello, who are you?\nAI: I am AI created by OpenAI. How can I help you today?\nMe: "
|
16 |
|
17 |
def openai_create(prompt):
|
18 |
|
19 |
response = openai.Completion.create(
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
29 |
return response.choices[0].text
|
30 |
|
31 |
|
@@ -50,6 +51,6 @@ with block:
|
|
50 |
message = gr.Textbox(placeholder=prompt)
|
51 |
state = gr.State()
|
52 |
submit = gr.Button("SEND")
|
53 |
-
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
54 |
|
55 |
-
block.launch(debug = True, share = False)
|
|
|
10 |
# print("key", openai.api_key)
|
11 |
|
12 |
start_sequence = "\nAI:"
|
13 |
+
restart_sequence = "\nMe:"
|
14 |
|
15 |
prompt = "Start by typing example content. Then use `Me:` or `AI:` with some clue to train model...\n\nMe: Hello, who are you?\nAI: I am AI created by OpenAI. How can I help you today?\nMe: "
|
16 |
|
17 |
def openai_create(prompt):
|
18 |
|
19 |
response = openai.Completion.create(
|
20 |
+
model="text-davinci-003",
|
21 |
+
prompt=prompt,
|
22 |
+
temperature=0.9,
|
23 |
+
max_tokens=500,
|
24 |
+
top_p=1,
|
25 |
+
frequency_penalty=0,
|
26 |
+
presence_penalty=0.6,
|
27 |
+
stop=[" Me:", " AI:"]
|
28 |
+
)
|
29 |
+
|
30 |
return response.choices[0].text
|
31 |
|
32 |
|
|
|
51 |
message = gr.Textbox(placeholder=prompt)
|
52 |
state = gr.State()
|
53 |
submit = gr.Button("SEND")
|
54 |
+
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state], api_name="chatgpt")
|
55 |
|
56 |
+
block.launch(debug = True, share = False, auth=("demo", "demo"))
|