write the app.py and upload data
Browse files
app.py
CHANGED
@@ -81,7 +81,7 @@ def ask(query, max_attempt_times=3):
|
|
81 |
while answer is None and attempt_times<max_attempt_times:
|
82 |
attempt_times += 1
|
83 |
try:
|
84 |
-
|
85 |
model="gpt-3.5-turbo",
|
86 |
messages=[
|
87 |
{"role": "user", "content": query}
|
@@ -129,7 +129,7 @@ def showcase(access_key):
|
|
129 |
recent_qas = qas[:10]
|
130 |
chatbot_ret = [(f"Your entered Access Key is correct.", f"The latest {len(recent_qas)} query-responses are displayed below.")]
|
131 |
for qa in recent_qas:
|
132 |
-
chatbot_ret += [(qa["q"].replace("\n","<br>"), qa["a"].replace("\n","<br>"))]
|
133 |
return chatbot_ret
|
134 |
|
135 |
|
|
|
81 |
while answer is None and attempt_times<max_attempt_times:
|
82 |
attempt_times += 1
|
83 |
try:
|
84 |
+
answer = openai.ChatCompletion.create(
|
85 |
model="gpt-3.5-turbo",
|
86 |
messages=[
|
87 |
{"role": "user", "content": query}
|
|
|
129 |
recent_qas = qas[:10]
|
130 |
chatbot_ret = [(f"Your entered Access Key is correct.", f"The latest {len(recent_qas)} query-responses are displayed below.")]
|
131 |
for qa in recent_qas:
|
132 |
+
chatbot_ret += [(qa["q"].replace("\n","<br>"), str(qa["a"]).replace("\n","<br>"))]
|
133 |
return chatbot_ret
|
134 |
|
135 |
|