Update app.py
Browse files
app.py
CHANGED
@@ -33,20 +33,19 @@ def get_text_file(text_docs):
|
|
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())
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
return text_doc
|
40 |
|
41 |
def get_csv_file(csv_docs):
|
42 |
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
43 |
temp_filepath = os.path.join(temp_dir.name, csv_docs.name) # μμ νμΌ κ²½λ‘λ₯Ό μμ±ν©λλ€.
|
44 |
with open(temp_filepath, "wb") as f: # μμ νμΌμ λ°μ΄λ리 μ°κΈ° λͺ¨λλ‘ μ½λλ€.
|
45 |
f.write(csv_docs.getvalue())
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
|
51 |
def get_json_file(json_docs):
|
52 |
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
@@ -55,6 +54,7 @@ def get_json_file(json_docs):
|
|
55 |
f.write(json_docs.getvalue())
|
56 |
json_loader = JSONLoader(temp_file.name,jq_schema='.messages[].content',text_content=False)
|
57 |
json_doc=json_loader.load
|
|
|
58 |
return json_doc
|
59 |
|
60 |
|
|
|
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())
|
36 |
+
text_loader = TextLoader(temp_file.name)
|
37 |
+
text_doc = text_loader.load()
|
38 |
+
return text_doc
|
|
|
39 |
|
40 |
def get_csv_file(csv_docs):
|
41 |
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
42 |
temp_filepath = os.path.join(temp_dir.name, csv_docs.name) # μμ νμΌ κ²½λ‘λ₯Ό μμ±ν©λλ€.
|
43 |
with open(temp_filepath, "wb") as f: # μμ νμΌμ λ°μ΄λ리 μ°κΈ° λͺ¨λλ‘ μ½λλ€.
|
44 |
f.write(csv_docs.getvalue())
|
45 |
+
csv_loader = CSVLoader(temp_file.name)
|
46 |
+
csv_doc = csv_loader.load()
|
47 |
|
48 |
+
return csv_doc
|
49 |
|
50 |
def get_json_file(json_docs):
|
51 |
temp_dir = tempfile.TemporaryDirectory() # μμ λλ ν 리λ₯Ό μμ±ν©λλ€.
|
|
|
54 |
f.write(json_docs.getvalue())
|
55 |
json_loader = JSONLoader(temp_file.name,jq_schema='.messages[].content',text_content=False)
|
56 |
json_doc=json_loader.load
|
57 |
+
|
58 |
return json_doc
|
59 |
|
60 |
|