bhaskartripathi commited on
Commit
241e0dd
1 Parent(s): 957bf1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -206,13 +206,22 @@ def generate_answer_text_davinci_003(question,openAI_key):
206
  answer = generate_text_text_davinci_003(openAI_key, prompt,"text-davinci-003")
207
  return answer
208
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  recommender = SemanticSearch()
211
 
212
  title = 'PDF GPT Turbo'
213
  description = """ PDF GPT Turbo allows you to chat with your PDF file using Universal Sentence Encoder and Open AI. It gives hallucination free response than other tools as the embeddings are better than OpenAI. The returned response can even cite the page number in square brackets([]) where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
214
 
215
-
216
  with gr.Blocks() as demo:
217
 
218
  gr.Markdown(f'<center><h1>{title}</h1></center>')
@@ -228,6 +237,12 @@ with gr.Blocks() as demo:
228
  gr.Markdown("<center><h4>OR<h4></center>")
229
  file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
230
  question = gr.Textbox(label='Enter your question here')
 
 
 
 
 
 
231
  model = gr.Radio(['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-16k-0613', 'text-davinci-003','gpt-4','gpt-4-32k'], label='Select Model', default='gpt-3.5-turbo')
232
  #model = gr.Dropdown(choices=['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-16k-0613', 'text-davinci-003'], label='Select Large Language Model', default='gpt-3.5-turbo')
233
  btn = gr.Button(value='Submit')
 
206
  answer = generate_text_text_davinci_003(openAI_key, prompt,"text-davinci-003")
207
  return answer
208
 
209
+ # pre-defined questions
210
+ questions = [
211
+ "what did the study be-60",
212
+ "what are the methods used in this study?",
213
+ "what are the methodologies used in this study?",
214
+ "what are the main findings of the study?",
215
+ "what are the main results of the study?",
216
+ "what is the contribution of this study?",
217
+ "what is the conclusion of this study?",
218
+ ]
219
 
220
  recommender = SemanticSearch()
221
 
222
  title = 'PDF GPT Turbo'
223
  description = """ PDF GPT Turbo allows you to chat with your PDF file using Universal Sentence Encoder and Open AI. It gives hallucination free response than other tools as the embeddings are better than OpenAI. The returned response can even cite the page number in square brackets([]) where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
224
 
 
225
  with gr.Blocks() as demo:
226
 
227
  gr.Markdown(f'<center><h1>{title}</h1></center>')
 
237
  gr.Markdown("<center><h4>OR<h4></center>")
238
  file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
239
  question = gr.Textbox(label='Enter your question here')
240
+ #Predefined questions
241
+ gr.Examples(
242
+ [[q] for q in questions],
243
+ inputs=[question],
244
+ label="Click on any example and press Enter in the input textbox!",
245
+ )
246
  model = gr.Radio(['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-16k-0613', 'text-davinci-003','gpt-4','gpt-4-32k'], label='Select Model', default='gpt-3.5-turbo')
247
  #model = gr.Dropdown(choices=['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-16k-0613', 'text-davinci-003'], label='Select Large Language Model', default='gpt-3.5-turbo')
248
  btn = gr.Button(value='Submit')