Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,24 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
# Function to
|
4 |
-
def
|
5 |
-
# Save the uploaded PDF file
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
11 |
|
12 |
# Gradio interface
|
13 |
iface = gr.Interface(
|
14 |
-
fn=
|
15 |
-
inputs=
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
)
|
21 |
|
22 |
-
# Launch the
|
23 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Function to handle the uploaded PDF file
|
4 |
+
def handle_uploaded_pdf(pdf_file):
|
5 |
+
# Save the uploaded PDF file for later use
|
6 |
+
pdf_file_path = "uploaded_file.pdf"
|
7 |
+
pdf_file.save(pdf_file_path)
|
8 |
+
|
9 |
+
# Print a welcome message
|
10 |
+
welcome_message = "Welcome! PDF file uploaded successfully. You can use the uploaded file later."
|
11 |
+
print(welcome_message)
|
12 |
|
13 |
# Gradio interface
|
14 |
iface = gr.Interface(
|
15 |
+
fn=handle_uploaded_pdf,
|
16 |
+
inputs=gr.File(label="Upload PDF", type="file"),
|
17 |
+
outputs="text",
|
18 |
+
live=True,
|
19 |
+
title="Welcome and PDF Upload",
|
20 |
+
description="This interface prints a welcome message and allows you to upload a PDF file for later use."
|
21 |
)
|
22 |
|
23 |
+
# Launch the interface
|
24 |
iface.launch()
|