Update app.py
Browse files
app.py
CHANGED
@@ -111,10 +111,15 @@ def text_lookup(data, sentence_ids):
|
|
111 |
return context
|
112 |
|
113 |
|
114 |
-
def gpt3_summary(
|
|
|
|
|
|
|
|
|
|
|
115 |
response = openai.Completion.create(
|
116 |
-
model="text-
|
117 |
-
prompt=
|
118 |
temperature=0.1,
|
119 |
max_tokens=512,
|
120 |
top_p=1.0,
|
@@ -237,11 +242,11 @@ if decoder_model == "GPT3 (summary_davinci)":
|
|
237 |
)
|
238 |
api_key = save_key(openai_key)
|
239 |
openai.api_key = api_key
|
240 |
-
output_text = []
|
241 |
-
for context_text in context_list:
|
242 |
-
|
243 |
-
generated_text = ". ".join(output_text)
|
244 |
-
st.write(gpt3_summary(
|
245 |
|
246 |
elif decoder_model == "GPT3 (QA_davinci)":
|
247 |
openai_key = st.text_input(
|
|
|
111 |
return context
|
112 |
|
113 |
|
114 |
+
def gpt3_summary(context_text, query):
|
115 |
+
prompt = f"""Context information is below. \n"
|
116 |
+
"---------------------\n {context_text}"
|
117 |
+
"\n---------------------\n"
|
118 |
+
"Given the context information and prior knowledge, "
|
119 |
+
"answer the question: {query}\n" """
|
120 |
response = openai.Completion.create(
|
121 |
+
model="text-ada-001",
|
122 |
+
prompt= prompt,
|
123 |
temperature=0.1,
|
124 |
max_tokens=512,
|
125 |
top_p=1.0,
|
|
|
242 |
)
|
243 |
api_key = save_key(openai_key)
|
244 |
openai.api_key = api_key
|
245 |
+
#output_text = []
|
246 |
+
#for context_text in context_list:
|
247 |
+
# output_text.append(gpt3_summary(context_text))
|
248 |
+
#generated_text = ". ".join(output_text)
|
249 |
+
st.write(gpt3_summary(context_text,query_text))
|
250 |
|
251 |
elif decoder_model == "GPT3 (QA_davinci)":
|
252 |
openai_key = st.text_input(
|