Update app.py
Browse files
app.py
CHANGED
@@ -17,10 +17,10 @@ def load_code(filename: str) -> str:
|
|
17 |
try:
|
18 |
with open(filename, 'r', encoding='utf-8') as file:
|
19 |
return file.read()
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
def load_parquet(filename: str) -> str:
|
26 |
try:
|
@@ -127,7 +127,9 @@ def text_to_parquet(text: str) -> Tuple[str, str, str]:
|
|
127 |
dtype=str,
|
128 |
quoting=csv.QUOTE_ALL, # λͺ¨λ νλλ₯Ό ν°λ°μ΄νλ‘ κ°μΈλ κ²μΌλ‘ μ²λ¦¬
|
129 |
escapechar='\\', # μ΄μ€μΌμ΄ν λ¬Έμ μ€μ
|
130 |
-
engine='python'
|
|
|
|
|
131 |
)
|
132 |
# λ°μ΄ν° μ ν μ΅μ ν
|
133 |
df = df.astype({'id': 'int32', 'text': 'string', 'label': 'string', 'metadata': 'string'})
|
@@ -402,3 +404,4 @@ if __name__ == "__main__":
|
|
402 |
|
403 |
|
404 |
|
|
|
|
17 |
try:
|
18 |
with open(filename, 'r', encoding='utf-8') as file:
|
19 |
return file.read()
|
20 |
+
except FileNotFoundError:
|
21 |
+
return f"{filename} νμΌμ μ°Ύμ μ μμ΅λλ€."
|
22 |
+
except Exception as e:
|
23 |
+
return f"νμΌμ μ½λ μ€ μ€λ₯κ° λ°μνμ΅λλ€: {str(e)}"
|
24 |
|
25 |
def load_parquet(filename: str) -> str:
|
26 |
try:
|
|
|
127 |
dtype=str,
|
128 |
quoting=csv.QUOTE_ALL, # λͺ¨λ νλλ₯Ό ν°λ°μ΄νλ‘ κ°μΈλ κ²μΌλ‘ μ²λ¦¬
|
129 |
escapechar='\\', # μ΄μ€μΌμ΄ν λ¬Έμ μ€μ
|
130 |
+
engine='python', # Python μμ§ μ¬μ©
|
131 |
+
header=None, # 첫 λ²μ§Έ νμ μ΄ μ΄λ¦μΌλ‘ μ¬μ©νμ§ μμ
|
132 |
+
names=['id', 'text', 'label', 'metadata'] # μ΄ μ΄λ¦ μ§μ
|
133 |
)
|
134 |
# λ°μ΄ν° μ ν μ΅μ ν
|
135 |
df = df.astype({'id': 'int32', 'text': 'string', 'label': 'string', 'metadata': 'string'})
|
|
|
404 |
|
405 |
|
406 |
|
407 |
+
|