[email protected] commited on
Commit
7cd4ae7
Β·
1 Parent(s): 6ff6804

edit codes

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -35,10 +35,9 @@ def get_text_file(docs):
35
  temp_filepath2 = os.path.join(temp_dir2.name, docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
36
  with open(temp_filepath2, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
37
  f.write(docs.getvalue()) # TXT λ¬Έμ„œμ˜ λ‚΄μš©μ„ μž„μ‹œ νŒŒμΌμ— μ”λ‹ˆλ‹€.
38
- txt_data = []
39
- for word in temp_filepath2:
40
- txt_data.append(word.split())
41
- return txt_data # μΆ”μΆœν•œ ν…μŠ€νŠΈλ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.
42
 
43
  def get_csv_file(docs):
44
  temp_dir3 = tempfile.TemporaryDirectory()
 
35
  temp_filepath2 = os.path.join(temp_dir2.name, docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
36
  with open(temp_filepath2, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
37
  f.write(docs.getvalue()) # TXT λ¬Έμ„œμ˜ λ‚΄μš©μ„ μž„μ‹œ νŒŒμΌμ— μ”λ‹ˆλ‹€.
38
+ text_loader = TextLoader(temp_filepath2) # Use your specific text loader here.
39
+ text_data = text_loader.load() # Extract text using the loader.
40
+ return text_data # μΆ”μΆœν•œ ν…μŠ€νŠΈλ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.
 
41
 
42
  def get_csv_file(docs):
43
  temp_dir3 = tempfile.TemporaryDirectory()