Mishmosh commited on
Commit
8d70f55
1 Parent(s): 9abcb7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -20
app.py CHANGED
@@ -1,24 +1,12 @@
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", filetype="pdf"),
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()
 
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()