Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,22 @@
|
|
1 |
# https://huggingface.co/spaces/Mishmosh/MichelleAssessment3
|
2 |
import gradio as gr
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
#python app.py
|
11 |
#python -m pip install --upgrade pip
|
12 |
#pip install torch torchvision torchaudio tensorflow
|
@@ -232,10 +242,10 @@ def read_pdf(pdf_path):
|
|
232 |
#drive.mount('/content/drive')
|
233 |
#read PDF
|
234 |
|
235 |
-
pdf_path = 'test.pdf' #article 11
|
236 |
#pdf_path = 'https://huggingface.co/spaces/Mishmosh/MichelleAssessment3/blob/main/test.pdf' #article 11
|
237 |
|
238 |
-
text_per_page = read_pdf(
|
239 |
|
240 |
# This section finds the abstract. My plan was to find the end of the abstract by identifying the same font size as the text 'abstract', but it was too late
|
241 |
#to try this here since the formatting of the text has already been removed.
|
|
|
1 |
# https://huggingface.co/spaces/Mishmosh/MichelleAssessment3
|
2 |
import gradio as gr
|
3 |
+
def process_input(pdf_file):
|
4 |
+
print("Received PDF File:", pdf_file.name)
|
5 |
+
with open("received_pdf.pdf", "wb") as output_file:
|
6 |
+
output_file.write(pdf_file.read())
|
7 |
+
return None
|
8 |
+
|
9 |
+
iface = gr.Interface(
|
10 |
+
fn=process_input,
|
11 |
+
inputs=[
|
12 |
+
gr.File(
|
13 |
+
type="binary",
|
14 |
+
label="Please upload a PDF file that contains an abstract. You will receive a one-sentence summary of the PDF and can listen to it.",
|
15 |
+
),
|
16 |
+
],
|
17 |
+
outputs=None,
|
18 |
+
)
|
19 |
+
iface.launch()
|
20 |
#python app.py
|
21 |
#python -m pip install --upgrade pip
|
22 |
#pip install torch torchvision torchaudio tensorflow
|
|
|
242 |
#drive.mount('/content/drive')
|
243 |
#read PDF
|
244 |
|
245 |
+
#pdf_path = 'test.pdf' #article 11
|
246 |
#pdf_path = 'https://huggingface.co/spaces/Mishmosh/MichelleAssessment3/blob/main/test.pdf' #article 11
|
247 |
|
248 |
+
text_per_page = read_pdf(received_pdf.pdf)
|
249 |
|
250 |
# This section finds the abstract. My plan was to find the end of the abstract by identifying the same font size as the text 'abstract', but it was too late
|
251 |
#to try this here since the formatting of the text has already been removed.
|