TerrenceDai commited on
Commit
2eeadab
·
1 Parent(s): 7efeebf

Update app.py

Browse files
Files changed (2) hide show
  1. __pycache__/Attn_conv.cpython-37.pyc +0 -0
  2. app.py +8 -2
__pycache__/Attn_conv.cpython-37.pyc ADDED
Binary file (1.43 kB). View file
 
app.py CHANGED
@@ -12,8 +12,14 @@ model.eval()
12
  # 推理函数
13
  def predict(file):
14
  # 读取上传的 JSON 文件
15
- with open(file.name, "r") as f:
16
- data = json.load(f)
 
 
 
 
 
 
17
 
18
  # 确保 JSON 格式正确
19
  channels = ["AccelX", "AccelY", "AccelZ", "GyroX", "GyroY", "GyroZ"]
 
12
  # 推理函数
13
  def predict(file):
14
  # 读取上传的 JSON 文件
15
+ try:
16
+ with open(file.name, "r") as f:
17
+ data = json.load(f)
18
+
19
+ # Process the data (example: return the file content length)
20
+ return f"File successfully processed. Content: {len(data)} items."
21
+ except Exception as e:
22
+ return f"Error processing file: {str(e)}"
23
 
24
  # 确保 JSON 格式正确
25
  channels = ["AccelX", "AccelY", "AccelZ", "GyroX", "GyroY", "GyroZ"]