Spaces:
Build error
Build error
Angelaangie
commited on
Commit
•
f74a44d
1
Parent(s):
0b3b5aa
Update app.py
Browse files
app.py
CHANGED
@@ -11,20 +11,65 @@ openai.api_key = "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"
|
|
11 |
start_sequence = "\nAI:"
|
12 |
restart_sequence = "\nHuman: "
|
13 |
|
14 |
-
prompt = "The following is a conversation with an AI assistant
|
15 |
|
16 |
def openai_create(prompt):
|
17 |
|
18 |
response = openai.Completion.create(
|
19 |
model="text-davinci-003",
|
20 |
-
prompt=
|
21 |
temperature=0.9,
|
22 |
max_tokens=150,
|
23 |
top_p=1,
|
24 |
frequency_penalty=0,
|
25 |
presence_penalty=0.6,
|
26 |
stop=[" Human:", " AI:"]
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
return response.choices[0].text
|
30 |
|
@@ -36,6 +81,7 @@ def chatgpt_clone(input, history):
|
|
36 |
s.append(input)
|
37 |
inp = ' '.join(s)
|
38 |
output = openai_create(inp)
|
|
|
39 |
history.append((input, output))
|
40 |
return history, history
|
41 |
|
@@ -44,7 +90,7 @@ block = gr.Blocks()
|
|
44 |
|
45 |
|
46 |
with block:
|
47 |
-
gr.Markdown("""<h1><center>
|
48 |
""")
|
49 |
chatbot = gr.Chatbot()
|
50 |
message = gr.Textbox(placeholder=prompt)
|
@@ -52,5 +98,4 @@ with block:
|
|
52 |
submit = gr.Button("SEND")
|
53 |
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
54 |
|
55 |
-
block.launch(debug = True)
|
56 |
-
|
|
|
11 |
start_sequence = "\nAI:"
|
12 |
restart_sequence = "\nHuman: "
|
13 |
|
14 |
+
prompt = "The following is a conversation with an AI assistant.\nHuman: "
|
15 |
|
16 |
def openai_create(prompt):
|
17 |
|
18 |
response = openai.Completion.create(
|
19 |
model="text-davinci-003",
|
20 |
+
prompt="\nHuman: Who is Angela Busheska? \nAI: Angela Busheska is the founder of EnRoute! She was chosen as a Forbes 30 Under 30. She is passionate about helping people to reduce carbon emissions. She has given keynotes at Google and Harvard.",
|
21 |
temperature=0.9,
|
22 |
max_tokens=150,
|
23 |
top_p=1,
|
24 |
frequency_penalty=0,
|
25 |
presence_penalty=0.6,
|
26 |
stop=[" Human:", " AI:"]
|
27 |
+
)
|
28 |
+
|
29 |
+
prompt1 = "What is Angela Busheska passionate about?. "
|
30 |
+
|
31 |
+
def openai_create1(prompt1):
|
32 |
+
|
33 |
+
response = openai.Completion.create(
|
34 |
+
model="text-davinci-003",
|
35 |
+
prompt="\nAI: Angela Busheska is passionate about saving the environment. She aspires to help people reduce carbon emissions from shopping and transport activities.",
|
36 |
+
temperature=0.9,
|
37 |
+
max_tokens=150,
|
38 |
+
top_p=1,
|
39 |
+
frequency_penalty=0,
|
40 |
+
presence_penalty=0.6,
|
41 |
+
stop=[" Human:", " AI:"]
|
42 |
+
)
|
43 |
+
|
44 |
+
prompt2 = "What is Angela Busheska studying?. "
|
45 |
+
|
46 |
+
def openai_create1(prompt2):
|
47 |
+
|
48 |
+
response = openai.Completion.create(
|
49 |
+
model="text-davinci-003",
|
50 |
+
prompt="\nAI: Angela Busheska is studying computer science and electrical engineering. Her goal is to utilize technology to solve the greatest problems with climate change. ",
|
51 |
+
temperature=0.9,
|
52 |
+
max_tokens=150,
|
53 |
+
top_p=1,
|
54 |
+
frequency_penalty=0,
|
55 |
+
presence_penalty=0.6,
|
56 |
+
stop=[" Human:", " AI:"]
|
57 |
+
)
|
58 |
+
|
59 |
+
prompt3 = "What did Angela Busheska discover?. "
|
60 |
+
|
61 |
+
def openai_create1(prompt2):
|
62 |
+
|
63 |
+
response = openai.Completion.create(
|
64 |
+
model="text-davinci-003",
|
65 |
+
prompt="\nAI: Angela Busheska created EnRoute to help people reduce their carbon footprint from daily activities. She mobilized over 60.000 people to fight for climate justice. ",
|
66 |
+
temperature=0.9,
|
67 |
+
max_tokens=150,
|
68 |
+
top_p=1,
|
69 |
+
frequency_penalty=0,
|
70 |
+
presence_penalty=0.6,
|
71 |
+
stop=[" Human:", " AI:"]
|
72 |
+
)
|
73 |
|
74 |
return response.choices[0].text
|
75 |
|
|
|
81 |
s.append(input)
|
82 |
inp = ' '.join(s)
|
83 |
output = openai_create(inp)
|
84 |
+
output = openai_create1(inp)
|
85 |
history.append((input, output))
|
86 |
return history, history
|
87 |
|
|
|
90 |
|
91 |
|
92 |
with block:
|
93 |
+
gr.Markdown("""<h1><center>Learn More About Me!</center></h1>
|
94 |
""")
|
95 |
chatbot = gr.Chatbot()
|
96 |
message = gr.Textbox(placeholder=prompt)
|
|
|
98 |
submit = gr.Button("SEND")
|
99 |
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
|
100 |
|
101 |
+
block.launch(debug = True, share = True)
|
|