Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,13 +51,15 @@ def get_csv_file(csv_docs):
|
|
| 51 |
return csv_doc # μΆμΆν ν
μ€νΈλ₯Ό λ°νν©λλ€.
|
| 52 |
|
| 53 |
def get_json_file(json_docs):
|
| 54 |
-
temp_dir = tempfile.TemporaryDirectory()
|
| 55 |
-
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 60 |
pprint('data json = ', data)
|
|
|
|
| 61 |
pass
|
| 62 |
|
| 63 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
|
|
|
| 51 |
return csv_doc # μΆμΆν ν
μ€νΈλ₯Ό λ°νν©λλ€.
|
| 52 |
|
| 53 |
def get_json_file(json_docs):
|
| 54 |
+
temp_dir = tempfile.TemporaryDirectory() # Create a temporary directory.
|
| 55 |
+
temp_filepath = os.path.join(temp_dir.name, json_docs.name) # Create a temporary file path.
|
| 56 |
+
|
| 57 |
+
with open(temp_filepath, "wb") as f:
|
| 58 |
+
f.write(json_docs.read()) # Write the content of the uploaded JSON file to the temporary file.
|
| 59 |
+
|
| 60 |
+
data = json.loads(Path(temp_filepath).read_text()) # Load JSON data from the temporary file.
|
| 61 |
pprint('data json = ', data)
|
| 62 |
+
return data
|
| 63 |
pass
|
| 64 |
|
| 65 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|