Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,12 +41,15 @@ def process_pdf_and_query(pdf_path, question):
|
|
41 |
return response
|
42 |
|
43 |
def chatbot_response(pdf, question):
|
44 |
-
# Gradio gibt uns
|
45 |
pdf_path = "/tmp/uploaded_pdf.pdf"
|
46 |
|
|
|
|
|
|
|
47 |
# Speichern des Byte-Streams von der Datei
|
48 |
with open(pdf_path, "wb") as f:
|
49 |
-
f.write(
|
50 |
|
51 |
# OCR-Text extrahieren
|
52 |
extracted_text = ocr_tool.extract_text(pdf_path)
|
|
|
41 |
return response
|
42 |
|
43 |
def chatbot_response(pdf, question):
|
44 |
+
# Gradio gibt uns die PDF als NamedString, wir extrahieren den Inhalt als Byte-Stream
|
45 |
pdf_path = "/tmp/uploaded_pdf.pdf"
|
46 |
|
47 |
+
# Extrahiere den Inhalt der Datei als Bytes
|
48 |
+
pdf_content = pdf.read() # Hier holen wir den Inhalt der PDF als Byte-Stream
|
49 |
+
|
50 |
# Speichern des Byte-Streams von der Datei
|
51 |
with open(pdf_path, "wb") as f:
|
52 |
+
f.write(pdf_content)
|
53 |
|
54 |
# OCR-Text extrahieren
|
55 |
extracted_text = ocr_tool.extract_text(pdf_path)
|