Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import fitz # PyMuPDF
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
def extract_text_from_pdf(pdf_file):
|
| 5 |
+
doc = fitz.open(stream=pdf_file.read(), filetype="pdf")
|
| 6 |
+
text = ""
|
| 7 |
+
for page in doc:
|
| 8 |
+
text += page.get_text()
|
| 9 |
+
return text[:3000] # Show only the first 3000 characters for now
|
| 10 |
+
|
| 11 |
+
gr.Interface(
|
| 12 |
+
fn=extract_text_from_pdf,
|
| 13 |
+
inputs=gr.File(file_types=[".pdf"]),
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="📄 JEE PDF Extractor"
|
| 16 |
+
).launch()
|