Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def upload_file(files):
|
4 |
-
|
5 |
-
|
|
|
6 |
|
7 |
with gr.Blocks() as demo:
|
8 |
file_output = gr.File()
|
9 |
-
upload_button = gr.UploadButton("Please upload a PDF that contains an abstract. I will provide a one-sentence summary of the abstract and will say the summary out loud.", file_types=["
|
10 |
upload_button.upload(upload_file, upload_button, file_output)
|
11 |
|
12 |
demo.launch()
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def upload_file(files):
|
4 |
+
# Assuming the user will upload only one PDF file, extract its name
|
5 |
+
pdf_file_path = [file.name for file in files if file.name.endswith(".pdf")]
|
6 |
+
return pdf_file_path
|
7 |
|
8 |
with gr.Blocks() as demo:
|
9 |
file_output = gr.File()
|
10 |
+
upload_button = gr.UploadButton("Please upload a PDF that contains an abstract. I will provide a one-sentence summary of the abstract and will say the summary out loud.", file_types=[".pdf"], file_count=1)
|
11 |
upload_button.upload(upload_file, upload_button, file_output)
|
12 |
|
13 |
demo.launch()
|
14 |
+
|