seawolf2357 commited on
Commit
a362e5f
ยท
verified ยท
1 Parent(s): b30eb63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -13,8 +13,6 @@ def extract_text_from_pdf(pdf_file):
13
  # ์ถ”์ถœ๋œ ํ…์ŠคํŠธ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์งˆ๋ฌธ์— ๋‹ต๋ณ€ํ•˜๋Š” ํ•จ์ˆ˜
14
  def answer_question(pdf_file, question):
15
  extracted_text = extract_text_from_pdf(pdf_file)
16
- # ์—ฌ๊ธฐ์—์„œ๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ ํ…์ŠคํŠธ์—์„œ ์งˆ๋ฌธ๊ณผ ์œ ์‚ฌํ•œ ๋ถ€๋ถ„์„ ์ฐพ์•„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
17
- # ๋ณด๋‹ค ๋ณต์žกํ•œ ๋กœ์ง์„ ๊ตฌํ˜„ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
18
  if question in extracted_text:
19
  start = extracted_text.find(question)
20
  end = extracted_text.find('.', start) + 1
@@ -25,7 +23,7 @@ def answer_question(pdf_file, question):
25
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์ •์˜
26
  iface = gr.Interface(
27
  fn=answer_question,
28
- inputs=[gr.File(type="file"), gr.Textbox(label="์งˆ๋ฌธ")],
29
  outputs=gr.Textbox()
30
  )
31
 
 
13
  # ์ถ”์ถœ๋œ ํ…์ŠคํŠธ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์งˆ๋ฌธ์— ๋‹ต๋ณ€ํ•˜๋Š” ํ•จ์ˆ˜
14
  def answer_question(pdf_file, question):
15
  extracted_text = extract_text_from_pdf(pdf_file)
 
 
16
  if question in extracted_text:
17
  start = extracted_text.find(question)
18
  end = extracted_text.find('.', start) + 1
 
23
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์ •์˜
24
  iface = gr.Interface(
25
  fn=answer_question,
26
+ inputs=[gr.File(type="binary"), gr.Textbox(label="์งˆ๋ฌธ")],
27
  outputs=gr.Textbox()
28
  )
29