Spaces:
Sleeping
Sleeping
httpdaniel commited on
Commit ·
e54f403
1
Parent(s): b17afa3
Adding skeleton
Browse files
app.py
CHANGED
|
@@ -1,7 +1,25 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from langchain_community.document_loaders import PyPDFLoader
|
| 3 |
|
| 4 |
+
def summarise_pdf(pdf, progress=gr.Progress()):
|
|
|
|
| 5 |
|
| 6 |
+
return "Summarised", "Complete!"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
with gr.Blocks() as demo:
|
| 10 |
+
|
| 11 |
+
gr.Markdown("<H1>PDF Summariser</H1>")
|
| 12 |
+
gr.Markdown("<H3>Upload a PDF file and generate a summary</H3>")
|
| 13 |
+
gr.Markdown("<H6>This project uses a MapReduce method to split the PDF into chunks, generate summaries of each of the chunks, and reduce them into a single final summary. Documents less than 3 pages use a Stuff method to simply stuff the entire document into the context window.</H6>")
|
| 14 |
+
|
| 15 |
+
with gr.Row():
|
| 16 |
+
with gr.Column(scale=1):
|
| 17 |
+
pdf = gr.File(label="1. Upload PDF")
|
| 18 |
+
summarise_btn = gr.Button(value="3. Summarise PDF", variant="primary")
|
| 19 |
+
summary_progress = gr.Textbox(value="Not Started", label="Summary Progress")
|
| 20 |
+
with gr.Column(scale=3):
|
| 21 |
+
summary = gr.TextArea(label="Summary")
|
| 22 |
+
|
| 23 |
+
summarise_btn.click(fn=summarise_pdf, inputs=pdf, outputs=[summary, summary_progress])
|
| 24 |
+
|
| 25 |
+
demo.launch()
|