Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,19 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def process_input(message, pdf_file):
|
| 4 |
+
print("Received Message:", message)
|
| 5 |
+
print("Received PDF File:", pdf_file.name)
|
| 6 |
+
|
| 7 |
+
# Save the received PDF file
|
| 8 |
+
with open("received_pdf.pdf", "wb") as output_file:
|
| 9 |
+
output_file.write(pdf_file.read())
|
| 10 |
|
| 11 |
+
return "Processing complete. Check the console for details."
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=process_input,
|
| 15 |
+
inputs=["text", gr.File(type="pdf", label="Upload PDF")],
|
| 16 |
+
outputs="text"
|
| 17 |
+
)
|
| 18 |
|
| 19 |
+
iface.launch()
|