TAneKAnz commited on
Commit
19d70b2
1 Parent(s): 1cabe85

history_table

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -36,7 +36,7 @@ def convert_to_grayscale(video_file, history):
36
  current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
37
  memory_usage = psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 # in MB
38
 
39
- history.append(f"#{len(history)+1} File Name: {file_name}, Collected on: {current_time}, Video Duration: {video_duration:.2f} seconds, Processing Time: {process_time:.2f} seconds, Memory Usage: {memory_usage:.2f} MB")
40
 
41
  return output_file, history
42
 
@@ -60,7 +60,7 @@ with gr.Blocks() as demo:
60
  history_output = gr.HTML(label="History")
61
 
62
  history_output.change(
63
- fn=lambda history: "<pre>" + "\n".join(history) + "</pre>",
64
  inputs=history_state,
65
  outputs=history_output,
66
  queue=False,
 
36
  current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
37
  memory_usage = psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 # in MB
38
 
39
+ history.append(f"#{len(history)+1} {file_name} {current_time} {video_duration:.2f} {process_time:.2f} {memory_usage:.2f}")
40
 
41
  return output_file, history
42
 
 
60
  history_output = gr.HTML(label="History")
61
 
62
  history_output.change(
63
+ fn=lambda history: "<table><tr><th>Entry</th><th>File Name</th><th>Collected On</th><th>Video Duration</th><th>Processing Time</th><th>Memory Usage</th></tr>" + "".join([f"<tr><td>{entry.split()[0]}</td><td>{entry.split()[1]}</td><td>{entry.split()[2]+' '+entry.split()[3]}</td><td>{entry.split()[4]} seconds</td><td>{entry.split()[5]} seconds</td><td>{entry.split()[6]} MB</td></tr>" for entry in history]) + "</table>",
64
  inputs=history_state,
65
  outputs=history_output,
66
  queue=False,