6QpgfMkKTVwUug commited on
Commit
cbab223
·
1 Parent(s): d223d6c
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
1
  import gradio as gr
2
+ import PyPDF2
3
+ import pandas as pd
4
 
5
+ def process_file(file):
6
+ # Read the uploaded file
7
+ with open(file.name, "rb") as f:
8
+ # Process the file here (e.g., extract text or convert to DataFrame)
9
+ # Example:
10
+ pdf_reader = PyPDF2.PdfFileReader(f)
11
+ num_pages = pdf_reader.numPages
12
+ text = ""
13
+ for page_num in range(num_pages):
14
+ page = pdf_reader.getPage(page_num)
15
+ text += page.extractText()
16
+ # Return the processed output
17
+ return text
18
+
19
+ iface = gr.Interface(fn=process_file, inputs="file", outputs="text")
20
 
21
+ iface.launch()