ledetele alexat commited on
Commit
59ea7b6
·
1 Parent(s): 7e8daf1

Update app.py (#1)

Browse files

- Update app.py (43e4b58e12e2bf086a0608e38f1b4baf077d1aaa)


Co-authored-by: alexa t <[email protected]>

Files changed (1) hide show
  1. app.py +33 -7
app.py CHANGED
@@ -163,27 +163,53 @@ def question_answer(url, file, question):
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:
170
 
171
  #gr.Markdown(f'<center><h1>{title}</h1></center>')
172
  #gr.Markdown(description)
173
 
174
- with gr.Row():
175
 
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
 
163
 
164
  recommender = SemanticSearch()
165
 
166
+ css = """
167
+ .gradio-container {
168
+ background-image: linear-gradient(#d7d7d7, #f2f2f2);
169
+ padding: 0;
170
+
171
+ }
172
+ .app.svelte-p7tiy3.svelte-p7tiy3 {
173
+ padding: 10;
174
+ }
175
+ .padded.svelte-faijhx {
176
+ padding: 30px 0 30px 0;
177
+ background-color: transparent;
178
+ }
179
+ #markdown-or{
180
+ background-color: transparent;
181
+ }
182
+
183
+ :root,.gradio-container-3-20-1 :host {
184
+ --color-border-primary:transparent;
185
+ }
186
+ #submit_button{
187
+ background-color: #fff;
188
+ font-weight: bold;
189
+ box-shadow: 5px 10px 18px #fff;
190
+ }
191
+ """
192
+
193
  title = 'AI Pdf 歸納器'
194
  #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."""
195
 
196
+ with gr.Blocks(css=css) as demo:
197
 
198
  #gr.Markdown(f'<center><h1>{title}</h1></center>')
199
  #gr.Markdown(description)
200
 
201
+ with gr.Row(css=css):
202
 
203
+ with gr.Group(css=css):
204
  #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>')
205
  #openAI_key=gr.Textbox(label='Enter your OpenAI API key here')
206
  url = gr.Textbox(label='在此處輸入 PDF 網址')
207
+ gr.Markdown("<center>或</center>", elem_id="markdown-or")
208
  file = gr.File(label='在此處上傳您的 PDF/研究論文/書籍', file_types=['.pdf'])
209
+ question = gr.Textbox(label='在這裡輸入您的問題', elem_id="question")
210
+ btn = gr.Button(value='提交', elem_id="submit_button")
211
  btn.style(full_width=True)
212
 
 
213
  answer = gr.Textbox(label='你的提問的答案是:')
214
 
215
  #openAI_key=api_key