Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -29,14 +29,27 @@ def get_pdf_text(pdf_docs):
29
  # 아래 텍스트 추출 함수를 작성
30
 
31
  def get_text_file(docs):
32
- pass
33
-
 
 
 
34
 
35
  def get_csv_file(docs):
36
- pass
 
 
 
 
 
37
 
38
  def get_json_file(docs):
39
- pass
 
 
 
 
 
40
 
41
 
42
  # 문서들을 처리하여 텍스트 청크로 나누는 함수입니다.
 
29
  # 아래 텍스트 추출 함수를 작성
30
 
31
  def get_text_file(docs):
32
+ if docs.type == 'text/plain':
33
+ text = docs.getvalue().decode("utf-8")
34
+ return [text]
35
+ else:
36
+ return []
37
 
38
  def get_csv_file(docs):
39
+ if docs.type == 'text/csv':
40
+ csv_text = docs.getvalue().decode("utf-8")
41
+
42
+ return csv_text.splitlines()
43
+ else:
44
+ return []
45
 
46
  def get_json_file(docs):
47
+ if docs.type == 'application/json':
48
+ json_text = docs.getvalue().decode("utf-8")
49
+
50
+ return [json_text]
51
+ else:
52
+ return []
53
 
54
 
55
  # 문서들을 처리하여 텍스트 청크로 나누는 함수입니다.