File size: 730 Bytes
e8e2778
 
abe1234
 
 
 
 
 
 
 
 
e8e2778
 
 
abe1234
9abcb7b
abe1234
 
 
 
e8e2778
 
abe1234
e8e2778
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gradio as gr

# Function to handle the uploaded PDF file
def handle_uploaded_pdf(pdf_file):
    # Save the uploaded PDF file for later use
    pdf_file_path = "uploaded_file.pdf"
    pdf_file.save(pdf_file_path)
    
    # Print a welcome message
    welcome_message = "Welcome! PDF file uploaded successfully. You can use the uploaded file later."
    print(welcome_message)

# Gradio interface
iface = gr.Interface(
    fn=handle_uploaded_pdf,
    inputs=gr.File(label="Upload PDF", filetype="pdf"),
    outputs="text",
    live=True,
    title="Welcome and PDF Upload",
    description="This interface prints a welcome message and allows you to upload a PDF file for later use."
)

# Launch the interface
iface.launch()