import gradio as gr | |
# Function to process the input message and PDF file | |
def process_input(message, pdf_file): | |
# Save the uploaded PDF file | |
pdf_file.save("uploaded_pdf.pdf") | |
# Process the message and return a result | |
result = f"Message: {message}\nPDF file uploaded successfully!" | |
return result | |
# Gradio interface | |
iface = gr.Interface( | |
fn=process_input, | |
inputs=[ | |
gr.inputs.Textbox(label="Enter your message"), | |
gr.inputs.File(label="Upload a PDF file", type="file", accept=".pdf") | |
], | |
outputs=gr.outputs.Textbox(label="Result") | |
) | |
# Launch the Gradio interface | |
iface.launch() | |