Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -29,14 +29,22 @@ 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
+ return docs.read()
 
33
 
34
  def get_csv_file(docs):
35
+ text = ''
36
+ if docs.name.endswith('.csv'):
37
+ reader = csv.reader(docs)
38
+ for row in reader:
39
+ text += ', '.join(row) + '\n'
40
+ return text
41
 
42
  def get_json_file(docs):
43
+ text = ''
44
+ if docs.name.endswith('.json'):
45
+ data = json.load(docs)
46
+ text = json.dumps(data, indent=4)
47
+ return text
48
 
49
 
50
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.