Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 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 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 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 |
-
|
| 24 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def upload_file(files):
|
| 4 |
+
file_paths = [file.name for file in files]
|
| 5 |
+
return file_paths
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
with gr.Blocks() as demo:
|
| 8 |
+
file_output = gr.File()
|
| 9 |
+
upload_button = gr.UploadButton("Click to Upload a File", file_types=["image", "video"], file_count="multiple")
|
| 10 |
+
upload_button.upload(upload_file, upload_button, file_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
demo.launch()
|
|
|