BraWler666 commited on
Commit
79c01c2
·
verified ·
1 Parent(s): aebdd78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -6,7 +6,7 @@ from PyPDF2 import PdfReader
6
  # Add your DeepSeek API Key
7
  DEEPSEEK_API_KEY = os.environ.get("DEEPSEEK_API_KEY", "your-key-here")
8
 
9
- # Function to extract text from uploaded PDF
10
  def extract_pdf_text(pdf_file):
11
  reader = PdfReader(pdf_file)
12
  text = ""
@@ -14,7 +14,6 @@ def extract_pdf_text(pdf_file):
14
  text += page.extract_text() or ""
15
  return text.strip()
16
 
17
- # Ask a question based on PDF content
18
  def ask_pdf(pdf_file, question):
19
  if not pdf_file or not question:
20
  return "⚠️ Please upload a PDF and enter a question."
@@ -42,7 +41,7 @@ def ask_pdf(pdf_file, question):
42
  except Exception as e:
43
  return f"❌ Error: {e}"
44
 
45
- # Gradio UI with updated modern design
46
  with gr.Blocks(css="""
47
  body {
48
  background-color: #111;
 
6
  # Add your DeepSeek API Key
7
  DEEPSEEK_API_KEY = os.environ.get("DEEPSEEK_API_KEY", "your-key-here")
8
 
9
+
10
  def extract_pdf_text(pdf_file):
11
  reader = PdfReader(pdf_file)
12
  text = ""
 
14
  text += page.extract_text() or ""
15
  return text.strip()
16
 
 
17
  def ask_pdf(pdf_file, question):
18
  if not pdf_file or not question:
19
  return "⚠️ Please upload a PDF and enter a question."
 
41
  except Exception as e:
42
  return f"❌ Error: {e}"
43
 
44
+
45
  with gr.Blocks(css="""
46
  body {
47
  background-color: #111;