Spaces:
Build error
Build error
Commit Β·
6974986
1
Parent(s): 0d627c2
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,19 +48,14 @@ def get_text_file(docs):
|
|
| 48 |
'''
|
| 49 |
def get_text_file(docs):
|
| 50 |
text_list = []
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
# νμΌμ λ€λ₯Έ λ°©μμΌλ‘ λμ½λ©νκ±°λ 건λλ°λλ‘ μ²λ¦¬ν μ μμ΅λλ€.
|
| 60 |
-
continue
|
| 61 |
-
except Exception as e:
|
| 62 |
-
print(f"An error occurred while extracting text: {e}")
|
| 63 |
-
continue # λ€λ₯Έ μμΈκ° λ°μνλ©΄ 건λλλλ€.
|
| 64 |
|
| 65 |
return text_list
|
| 66 |
|
|
|
|
| 48 |
'''
|
| 49 |
def get_text_file(docs):
|
| 50 |
text_list = []
|
| 51 |
+
try:
|
| 52 |
+
text = docs.getvalue().decode("utf-8") # νμΌ λ΄μ©μ utf-8 νμμΌλ‘ λμ½λ©νμ¬ ν
μ€νΈλ‘ λ³νν©λλ€.
|
| 53 |
+
text_list.append(text)
|
| 54 |
+
except UnicodeDecodeError as decode_error:
|
| 55 |
+
print(f"UnicodeDecodeError occurred while decoding text: {decode_error}")
|
| 56 |
+
# νμΌμ λ€λ₯Έ λ°©μμΌλ‘ λμ½λ©νκ±°λ 건λλ°λλ‘ μ²λ¦¬ν μ μμ΅λλ€.
|
| 57 |
+
except Exception as e:
|
| 58 |
+
print(f"An error occurred while extracting text: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
return text_list
|
| 61 |
|