Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -3,12 +3,16 @@ 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()
 
 
 
3
  from pdfminer.high_level import extract_text
4
 
5
  def read_pdf(file):
6
+ if file is None:
7
+ return "No file uploaded"
8
  text = extract_text(file.name)
9
  return text
10
 
11
  iface = gr.Interface(
12
+ fn=read_pdf,
13
+ inputs=gr.File(label="Upload PDF file"),
14
+ outputs=gr.Textbox(label="Extracted Text")
15
  )
16
+
17
+ if __name__ == "__main__":
18
+ iface.launch()