varun500 commited on
Commit
2e51f4a
1 Parent(s): 02f296a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -111,10 +111,15 @@ def text_lookup(data, sentence_ids):
111
  return context
112
 
113
 
114
- def gpt3_summary(text):
 
 
 
 
 
115
  response = openai.Completion.create(
116
- model="text-davinci-003",
117
- prompt=text + "\n\nTl;dr",
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
- output_text.append(gpt3_summary(context_text))
243
- generated_text = ". ".join(output_text)
244
- st.write(gpt3_summary(generated_text))
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(