Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -169,7 +169,7 @@ def update_file_selection(selected_file):
|
|
169 |
annotations_file = DATASET_DIR / f"{file_base_name}_annotations-{uuid4()}.json"
|
170 |
score_file = DATASET_DIR / f"{file_base_name}_score-{uuid4()}.json"
|
171 |
|
172 |
-
return get_current_text() + ("", "
|
173 |
|
174 |
def update_index_selection(selected_index):
|
175 |
global current_index, data
|
@@ -180,6 +180,16 @@ def update_index_selection(selected_index):
|
|
180 |
return get_current_text() + (str(current_index), f"已跳轉至 id: {selected_index}")
|
181 |
except:
|
182 |
return "錯誤", "錯誤", str(current_index), "選擇的索引無效,請重新選擇"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
|
185 |
categories = {
|
|
|
169 |
annotations_file = DATASET_DIR / f"{file_base_name}_annotations-{uuid4()}.json"
|
170 |
score_file = DATASET_DIR / f"{file_base_name}_score-{uuid4()}.json"
|
171 |
|
172 |
+
return get_current_text() + ("", "", str(current_index), f"已加載檔案:{selected_file}")
|
173 |
|
174 |
def update_index_selection(selected_index):
|
175 |
global current_index, data
|
|
|
180 |
return get_current_text() + (str(current_index), f"已跳轉至 id: {selected_index}")
|
181 |
except:
|
182 |
return "錯誤", "錯誤", str(current_index), "選擇的索引無效,請重新選擇"
|
183 |
+
def update_index_selection(selected_index):
|
184 |
+
global current_index, data
|
185 |
+
try:
|
186 |
+
selected_index = int(selected_index)
|
187 |
+
if selected_index in data["id"].values:
|
188 |
+
current_index = data.index[data["id"] == selected_index].tolist()[0]
|
189 |
+
return get_current_text() + (str(current_index), f"已跳轉至 id: {selected_index}")
|
190 |
+
except:
|
191 |
+
return "錯誤", "錯誤", str(current_index), "選擇的索引無效,請重新選擇"
|
192 |
+
|
193 |
|
194 |
|
195 |
categories = {
|