psyne commited on
Commit
e0f54ae
1 Parent(s): 88b712e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -103,9 +103,9 @@ def load_recommender(paths, start_page=1):
103
  return 'Corpus Loaded.'
104
 
105
 
106
- def generate_text(prompt):
107
  completions = openai.Completion.create(
108
- engine=os.environ('Engine'),
109
  prompt=prompt,
110
  max_tokens=512,
111
  n=1,
@@ -117,6 +117,7 @@ def generate_text(prompt):
117
 
118
 
119
  def generate_answer(question):
 
120
  topn_chunks = recommender(question)
121
  prompt = ""
122
  prompt += 'search results:\n\n'
@@ -133,7 +134,7 @@ def generate_answer(question):
133
  "answer should be short and concise.\n\nQuery: {question}\nAnswer: "
134
 
135
  prompt += f"Query: {question}\nAnswer:"
136
- answer = generate_text(prompt)
137
  return answer
138
 
139
 
 
103
  return 'Corpus Loaded.'
104
 
105
 
106
+ def generate_text(prompt,engine):
107
  completions = openai.Completion.create(
108
+ engine=engine,
109
  prompt=prompt,
110
  max_tokens=512,
111
  n=1,
 
117
 
118
 
119
  def generate_answer(question):
120
+ engine = os.environ('Engine')
121
  topn_chunks = recommender(question)
122
  prompt = ""
123
  prompt += 'search results:\n\n'
 
134
  "answer should be short and concise.\n\nQuery: {question}\nAnswer: "
135
 
136
  prompt += f"Query: {question}\nAnswer:"
137
+ answer = generate_text(prompt, engine)
138
  return answer
139
 
140