poemsforaphrodite commited on
Commit
0d1233c
1 Parent(s): b7d0104

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +3 -9
  2. app.py +21 -0
  3. requirements.txt +2 -0
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: Ghana Helper
3
- emoji: 👁
4
- colorFrom: pink
5
- colorTo: red
6
- sdk: gradio
7
- sdk_version: 4.44.0
8
  app_file: app.py
9
- pinned: false
 
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: ghana-helper
 
 
 
 
 
3
  app_file: app.py
4
+ sdk: gradio
5
+ sdk_version: 4.42.0
6
  ---
 
 
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import PyPDF2
3
+ import io
4
+
5
+ def transcribe_pdf(pdf_file):
6
+ pdf_reader = PyPDF2.PdfReader(io.BytesIO(pdf_file))
7
+ text = ""
8
+ for page in pdf_reader.pages:
9
+ text += page.extract_text() + "\n"
10
+ return text
11
+
12
+ iface = gr.Interface(
13
+ fn=transcribe_pdf,
14
+ inputs=gr.File(label="Upload PDF", type="binary"),
15
+ outputs=gr.Textbox(label="Transcription"),
16
+ title="PDF Transcription",
17
+ description="Upload a PDF file to extract its text content."
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ PyPDF2