alisrbdni commited on
Commit
d051573
·
verified ·
1 Parent(s): 93e5a38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -1018,11 +1018,18 @@ def read_log_file2():
1018
  def main():
1019
  st.write("## Federated Learning with Dynamic Models and Datasets for Mobile Devices")
1020
  logs = read_log_file2()
1021
- st.markdown(logs)
 
 
 
 
 
 
 
1022
  # Provide a download button for the logs
1023
  st.download_button(
1024
  label="Download Logs",
1025
- data=logs,
1026
  file_name="./log.txt",
1027
  mime="text/plain"
1028
  )
@@ -1087,7 +1094,10 @@ def main():
1087
  st.write(f"### Round {round_num + 1} ✅")
1088
 
1089
  logs = read_log_file2()
1090
- st.markdown(logs)
 
 
 
1091
  # Provide a download button for the logs
1092
  # st.download_button(
1093
  # label="Download Logs",
@@ -1099,8 +1109,8 @@ def main():
1099
  accuracy_pattern = re.compile(r"'accuracy': \{(\d+), ([\d.]+)\}")
1100
  loss_pattern = re.compile(r"'loss': \{(\d+), ([\d.]+)\}")
1101
 
1102
- accuracy_matches = accuracy_pattern.findall(logs)
1103
- loss_matches = loss_pattern.findall(logs)
1104
 
1105
  rounds = [int(match[0]) for match in accuracy_matches]
1106
  accuracies = [float(match[1]) for match in accuracy_matches]
 
1018
  def main():
1019
  st.write("## Federated Learning with Dynamic Models and Datasets for Mobile Devices")
1020
  logs = read_log_file2()
1021
+ # cleanLogs = # Define a pattern to match relevant log entries
1022
+ pattern = re.compile(r"memory|loss|accuracy|round|client", re.IGNORECASE)
1023
+
1024
+
1025
+ # Filter the log data
1026
+ filtered_logs = [line for line in logs.splitlines() if pattern.search(line)]
1027
+ st.markdown(filtered_logs)
1028
+
1029
  # Provide a download button for the logs
1030
  st.download_button(
1031
  label="Download Logs",
1032
+ data=filtered_logs,
1033
  file_name="./log.txt",
1034
  mime="text/plain"
1035
  )
 
1094
  st.write(f"### Round {round_num + 1} ✅")
1095
 
1096
  logs = read_log_file2()
1097
+ filtered_logs = [line for line in logs.splitlines() if pattern.search(line)]
1098
+
1099
+
1100
+ st.markdown(filtered_logs)
1101
  # Provide a download button for the logs
1102
  # st.download_button(
1103
  # label="Download Logs",
 
1109
  accuracy_pattern = re.compile(r"'accuracy': \{(\d+), ([\d.]+)\}")
1110
  loss_pattern = re.compile(r"'loss': \{(\d+), ([\d.]+)\}")
1111
 
1112
+ accuracy_matches = accuracy_pattern.findall(filtered_logs)
1113
+ loss_matches = loss_pattern.findall(filtered_logs)
1114
 
1115
  rounds = [int(match[0]) for match in accuracy_matches]
1116
  accuracies = [float(match[1]) for match in accuracy_matches]