sblumenf commited on
Commit
f18cf35
1 Parent(s): ab26203

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -1,18 +1,14 @@
1
  import gradio as gr
2
  import pdfminer
3
  from pdfminer.high_level import extract_text
4
- import urllib.request
5
 
6
- def read_pdf(file, url):
7
- if url is not None and url != "":
8
- file = urllib.request.urlretrieve(url)[0]
9
- text = extract_text(file)
10
  return text
11
 
12
  iface = gr.Interface(
13
  read_pdf,
14
- gr.inputs.File(examples='path/to/example_pdf_files'),
15
- gr.inputs.Textbox(label="Enter URL of pdf"),
16
  gr.outputs.Textbox()
17
  )
18
  iface.launch()
 
1
  import gradio as gr
2
  import pdfminer
3
  from pdfminer.high_level import extract_text
 
4
 
5
+ def read_pdf(file):
6
+ text = extract_text(file.name)
 
 
7
  return text
8
 
9
  iface = gr.Interface(
10
  read_pdf,
11
+ gr.inputs.File(),
 
12
  gr.outputs.Textbox()
13
  )
14
  iface.launch()