ledetele commited on
Commit
7e8daf1
·
1 Parent(s): e54eaf4

Translated

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -138,10 +138,10 @@ def question_answer(url, file, question):
138
  #if openAI_key.strip()=='':
139
  # return '[ERROR]: Please enter you Open AI Key. Get your key here : https://platform.openai.com/account/api-keys'
140
  if url.strip() == '' and file == None:
141
- return '[ERROR]: Both URL and PDF is empty. Provide atleast one.'
142
 
143
  if url.strip() != '' and file != None:
144
- return '[ERROR]: Both URL and PDF is provided. Please provide only one (eiter URL or PDF).'
145
 
146
  if url.strip() != '':
147
  glob_url = url
@@ -156,14 +156,14 @@ def question_answer(url, file, question):
156
  load_recommender(file_name)
157
 
158
  if question.strip() == '':
159
- return '[ERROR]: Question field is empty'
160
 
161
  return generate_answer(question,api_key)
162
 
163
 
164
  recommender = SemanticSearch()
165
 
166
- title = 'AI Pdf Summarizer'
167
  #description = """ KrystalPDF AI allows you to chat with your PDF file. It gives hallucination free response than other tools. 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."""
168
 
169
  with gr.Blocks() as demo:
@@ -176,15 +176,15 @@ with gr.Blocks() as demo:
176
  with gr.Group():
177
  #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>')
178
  #openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
179
- url = gr.Textbox(label='Enter PDF URL here')
180
- gr.Markdown("<center><h4>OR<h4></center>")
181
- file = gr.File(label='Upload your PDF/ Research Paper / Book here', file_types=['.pdf'])
182
- question = gr.Textbox(label='Enter your question here')
183
- btn = gr.Button(value='Submit')
184
  btn.style(full_width=True)
185
 
186
  with gr.Group():
187
- answer = gr.Textbox(label='The answer to your question is :')
188
 
189
  #openAI_key=api_key
190
  btn.click(question_answer, inputs=[url, file, question], outputs=[answer])
 
138
  #if openAI_key.strip()=='':
139
  # return '[ERROR]: Please enter you Open AI Key. Get your key here : https://platform.openai.com/account/api-keys'
140
  if url.strip() == '' and file == None:
141
+ return '[ERROR]: URL PDF 都是空的。 至少提供一個。'
142
 
143
  if url.strip() != '' and file != None:
144
+ return '[ERROR]: 提供了 URL PDF 請僅提供一個(網址或 PDF)。'
145
 
146
  if url.strip() != '':
147
  glob_url = url
 
156
  load_recommender(file_name)
157
 
158
  if question.strip() == '':
159
+ return '[ERROR]: 問題字段為空'
160
 
161
  return generate_answer(question,api_key)
162
 
163
 
164
  recommender = SemanticSearch()
165
 
166
+ title = 'AI Pdf 歸納器'
167
  #description = """ KrystalPDF AI allows you to chat with your PDF file. It gives hallucination free response than other tools. 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."""
168
 
169
  with gr.Blocks() as demo:
 
176
  with gr.Group():
177
  #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>')
178
  #openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
179
+ url = gr.Textbox(label='在此處輸入 PDF 網址')
180
+ gr.Markdown("<center><h4>或<h4></center>")
181
+ file = gr.File(label='在此處上傳您的 PDF/研究論文/書籍', file_types=['.pdf'])
182
+ question = gr.Textbox(label='在這裡輸入您的問題')
183
+ btn = gr.Button(value='提交')
184
  btn.style(full_width=True)
185
 
186
  with gr.Group():
187
+ answer = gr.Textbox(label='你的提問的答案是:')
188
 
189
  #openAI_key=api_key
190
  btn.click(question_answer, inputs=[url, file, question], outputs=[answer])