Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,20 +37,16 @@ def get_all_files(directory):
|
|
| 37 |
for root, dirs, files in os.walk(directory):
|
| 38 |
for file in files:
|
| 39 |
all_files.append(os.path.join(root, file))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
return all_files
|
| 41 |
|
| 42 |
# 指定工作目录
|
| 43 |
working_directory = '/home/user/app'
|
| 44 |
-
|
| 45 |
# 列出工作目录及其子目录下的所有文件
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
# 打印所有文件路径
|
| 49 |
-
print("所有的文件:")
|
| 50 |
-
for file in all_files:
|
| 51 |
-
print(file)
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
"""# load MobileNet model"""
|
| 56 |
|
|
@@ -271,7 +267,13 @@ def Aspergillus_Detect():
|
|
| 271 |
a.append([i,round(df_pivot[i].sum()/detect_number,3)])
|
| 272 |
a = sorted(a,key=lambda x: x[1],reverse=True)
|
| 273 |
|
| 274 |
-
print(f'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
result = [f'Prediction of species of Aspergillus: {a[0][0] if a[0][1] >= threshold else "Unclassified"}',
|
| 276 |
f'There are {df_pivot.shape[0]} mold images.',
|
| 277 |
f'Yolov7 detects {detect_number} instances.',
|
|
@@ -289,10 +291,10 @@ def classify_images(files):
|
|
| 289 |
# 列出工作目录及其子目录下的所有文件
|
| 290 |
all_files = get_all_files(working_directory)
|
| 291 |
|
| 292 |
-
# 打印所有文件路径
|
| 293 |
-
print("所有的文件:")
|
| 294 |
-
for file in all_files:
|
| 295 |
-
|
| 296 |
|
| 297 |
if predict == 'Aspergillus':
|
| 298 |
result2 = Aspergillus_Detect()
|
|
|
|
| 37 |
for root, dirs, files in os.walk(directory):
|
| 38 |
for file in files:
|
| 39 |
all_files.append(os.path.join(root, file))
|
| 40 |
+
# 打印所有文件路径
|
| 41 |
+
print("所有的文件:")
|
| 42 |
+
for file in all_files:
|
| 43 |
+
print(file)
|
| 44 |
return all_files
|
| 45 |
|
| 46 |
# 指定工作目录
|
| 47 |
working_directory = '/home/user/app'
|
|
|
|
| 48 |
# 列出工作目录及其子目录下的所有文件
|
| 49 |
+
get_all_files(working_directory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
"""# load MobileNet model"""
|
| 52 |
|
|
|
|
| 267 |
a.append([i,round(df_pivot[i].sum()/detect_number,3)])
|
| 268 |
a = sorted(a,key=lambda x: x[1],reverse=True)
|
| 269 |
|
| 270 |
+
print(f'\na: {a}\n')
|
| 271 |
+
|
| 272 |
+
# 指定工作目录
|
| 273 |
+
working_directory = '/home/user/app'
|
| 274 |
+
# 列出工作目录及其子目录下的所有文件
|
| 275 |
+
get_all_files(working_directory)
|
| 276 |
+
|
| 277 |
result = [f'Prediction of species of Aspergillus: {a[0][0] if a[0][1] >= threshold else "Unclassified"}',
|
| 278 |
f'There are {df_pivot.shape[0]} mold images.',
|
| 279 |
f'Yolov7 detects {detect_number} instances.',
|
|
|
|
| 291 |
# 列出工作目录及其子目录下的所有文件
|
| 292 |
all_files = get_all_files(working_directory)
|
| 293 |
|
| 294 |
+
# # 打印所有文件路径
|
| 295 |
+
# print("所有的文件:")
|
| 296 |
+
# for file in all_files:
|
| 297 |
+
# print(file)
|
| 298 |
|
| 299 |
if predict == 'Aspergillus':
|
| 300 |
result2 = Aspergillus_Detect()
|