Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,23 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Gradio interface
|
| 4 |
iface = gr.Interface(
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
)
|
| 11 |
|
| 12 |
-
# Launch the interface
|
| 13 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Function to process the input message and PDF file
|
| 4 |
+
def process_input(message, pdf_file):
|
| 5 |
+
# Save the uploaded PDF file
|
| 6 |
+
pdf_file.save("uploaded_pdf.pdf")
|
| 7 |
+
|
| 8 |
+
# Process the message and return a result
|
| 9 |
+
result = f"Message: {message}\nPDF file uploaded successfully!"
|
| 10 |
+
return result
|
| 11 |
+
|
| 12 |
# Gradio interface
|
| 13 |
iface = gr.Interface(
|
| 14 |
+
fn=process_input,
|
| 15 |
+
inputs=[
|
| 16 |
+
gr.inputs.Textbox(label="Enter your message"),
|
| 17 |
+
gr.inputs.File(label="Upload a PDF file", type="file", accept=".pdf")
|
| 18 |
+
],
|
| 19 |
+
outputs=gr.outputs.Textbox(label="Result")
|
| 20 |
)
|
| 21 |
|
| 22 |
+
# Launch the Gradio interface
|
| 23 |
+
iface.launch()
|