bhaskartripathi commited on
Commit
a886e2b
1 Parent(s): 2092920

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -231,13 +231,11 @@ questions = [
231
  "what is the dependent variable in this study?",
232
  ]
233
 
234
- def mask_key(key):
235
- return '*' * len(key)
236
-
237
  recommender = SemanticSearch()
238
 
239
  title = 'PDF GPT Turbo'
240
- 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."""
241
 
242
  with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as demo:
243
 
@@ -248,7 +246,6 @@ with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as dem
248
 
249
  with gr.Group():
250
  gr.Markdown(f'<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>')
251
- openAI_key = gr.Textbox(label='Enter your OpenAI API key here', preprocess=mask_key)
252
  url = gr.Textbox(label='Enter PDF URL here (Example: https://arxiv.org/pdf/1706.06722.pdf )')
253
  gr.Markdown("<center><h4>OR<h4></center>")
254
  file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
@@ -272,9 +269,10 @@ with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as dem
272
  btn.style(full_width=True)
273
 
274
  with gr.Group():
275
- #chatbot = gr.Chatbot(placeholder="Chat History", label="Chat History", lines=20, elem_id="chatbot")
276
  chatbot = gr.Chatbot(placeholder="Chat History", label="Chat History", lines=50, elem_id="chatbot")
277
-
 
 
278
 
279
  # Bind the click event of the button to the question_answer function
280
  btn.click(
@@ -285,3 +283,4 @@ with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as dem
285
 
286
  demo.launch()
287
 
 
 
231
  "what is the dependent variable in this study?",
232
  ]
233
 
234
+
 
 
235
  recommender = SemanticSearch()
236
 
237
  title = 'PDF GPT Turbo'
238
+ 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([Page No.]) where the information is located, adding credibility to the responses and helping to locate pertinent information quickly."""
239
 
240
  with gr.Blocks(css="""#chatbot { font-size: 14px; min-height: 1200; }""") as demo:
241
 
 
246
 
247
  with gr.Group():
248
  gr.Markdown(f'<p style="text-align:center">Get your Open AI API key <a href="https://platform.openai.com/account/api-keys">here</a></p>')
 
249
  url = gr.Textbox(label='Enter PDF URL here (Example: https://arxiv.org/pdf/1706.06722.pdf )')
250
  gr.Markdown("<center><h4>OR<h4></center>")
251
  file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
 
269
  btn.style(full_width=True)
270
 
271
  with gr.Group():
 
272
  chatbot = gr.Chatbot(placeholder="Chat History", label="Chat History", lines=50, elem_id="chatbot")
273
+
274
+ with gr.Accordion("API Key"):
275
+ openAI_key = gr.Textbox(label='Enter your OpenAI API key here', password=True)
276
 
277
  # Bind the click event of the button to the question_answer function
278
  btn.click(
 
283
 
284
  demo.launch()
285
 
286
+