Spaces:
Runtime error
Runtime error
JinHyeong99
commited on
Commit
Β·
946b62f
1
Parent(s):
131879f
app.py
CHANGED
@@ -31,7 +31,9 @@ def get_pdf_text(pdf_docs):
|
|
31 |
def get_text_file(text_docs):
|
32 |
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
33 |
temp_filepath = os.path.join(temp_dir.name, text_docs.name) # μμ νμΌ κ²½λ‘λ₯Ό μμ±ν©λλ€.
|
34 |
-
|
|
|
|
|
35 |
text_doc = text_loader.load()
|
36 |
return text_doc
|
37 |
|
|
|
31 |
def get_text_file(text_docs):
|
32 |
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
33 |
temp_filepath = os.path.join(temp_dir.name, text_docs.name) # μμ νμΌ κ²½λ‘λ₯Ό μμ±ν©λλ€.
|
34 |
+
with open(temp_filepath, "wb") as f: # μμ νμΌμ λ°μ΄λ리 μ°κΈ° λͺ¨λλ‘ μ½λλ€.
|
35 |
+
f.write(text_docs.getvalue()) # Text λ¬Έμμ λ΄μ©μ μμ νμΌμ μλλ€.
|
36 |
+
text_loader = TextLoader(temp_filepath) # TextLoader μΈμ€ν΄μ€λ₯Ό μμ±ν©λλ€.
|
37 |
text_doc = text_loader.load()
|
38 |
return text_doc
|
39 |
|