Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def run_training():
|
|
25 |
def run_inference():
|
26 |
global inference_logs
|
27 |
inference_logs = []
|
28 |
-
|
29 |
|
30 |
process = subprocess.Popen(
|
31 |
["python", "inference.py"],
|
@@ -36,14 +36,18 @@ def run_inference():
|
|
36 |
)
|
37 |
for line in process.stdout:
|
38 |
inference_logs.append(line)
|
39 |
-
|
|
|
|
|
40 |
|
41 |
-
|
|
|
42 |
f.write("=== New Inference Run ===\n")
|
43 |
-
f.writelines(
|
44 |
f.write("\n")
|
45 |
|
46 |
-
|
|
|
47 |
|
48 |
def list_saved_files():
|
49 |
files = os.listdir(data_dir)
|
|
|
25 |
def run_inference():
|
26 |
global inference_logs
|
27 |
inference_logs = []
|
28 |
+
summary_line = ""
|
29 |
|
30 |
process = subprocess.Popen(
|
31 |
["python", "inference.py"],
|
|
|
36 |
)
|
37 |
for line in process.stdout:
|
38 |
inference_logs.append(line)
|
39 |
+
# التحقق من وجود ملخص
|
40 |
+
if "Summary for UI" in line:
|
41 |
+
summary_line = line.strip()
|
42 |
|
43 |
+
# حفظ النتائج
|
44 |
+
with open("/home/user/data/inference_results.txt", "a") as f:
|
45 |
f.write("=== New Inference Run ===\n")
|
46 |
+
f.writelines(inference_logs)
|
47 |
f.write("\n")
|
48 |
|
49 |
+
return summary_line or "\n".join(inference_logs[-50:])
|
50 |
+
|
51 |
|
52 |
def list_saved_files():
|
53 |
files = os.listdir(data_dir)
|