DDingcheol commited on
Commit
111a329
Β·
1 Parent(s): 08db112

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -17
app.py CHANGED
@@ -24,23 +24,10 @@ def get_pdf_text(pdf_docs):
24
 
25
  # 과제
26
  # μ•„λž˜ ν…μŠ€νŠΈ μΆ”μΆœ ν•¨μˆ˜λ₯Ό μž‘μ„±
27
- def get_text_file(docs):
28
- # .txt 파일의 λ‚΄μš©μ„ 담을 λ³€μˆ˜
29
- txt_content = ""
30
-
31
- # μž„μ‹œ 디렉토리 생성
32
- temp_dir = tempfile.TemporaryDirectory()
33
- temp_filepath = os.path.join(temp_dir.name, docs.name)
34
-
35
- # .txt 파일의 λ‚΄μš©μ„ μž„μ‹œ νŒŒμΌμ— μ”λ‹ˆλ‹€.
36
- with open(temp_filepath, "wb") as f:
37
- f.write(docs.getvalue())
38
-
39
- # .txt νŒŒμΌμ„ μ½μ–΄μ„œ λ‚΄μš©μ„ txt_content에 μ €μž₯ν•©λ‹ˆλ‹€.
40
- with open(temp_filepath, "r", encoding="utf-8") as f:
41
- txt_content = f.read()
42
-
43
- return txt_content
44
 
45
  def get_csv_file(docs):
46
  pass
 
24
 
25
  # 과제
26
  # μ•„λž˜ ν…μŠ€νŠΈ μΆ”μΆœ ν•¨μˆ˜λ₯Ό μž‘μ„±
27
+ def get_text_file(txt_docs):
28
+ txt_content = txt_docs.read().decode("utf-8")
29
+ return txt_content
30
+
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  def get_csv_file(docs):
33
  pass