Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
7 |
-
|
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(
|
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()
|