Pranjal Pruthi commited on
Commit
d6193e8
·
1 Parent(s): c79705c

Add application files and dependencies

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -11,7 +11,7 @@ import shutil
11
  import re
12
  import threading
13
  import psutil
14
- from video_processor import process_video, get_status, get_error_details, status_dict, cancel_job
15
 
16
 
17
  st.set_page_config(layout="wide")
@@ -176,17 +176,18 @@ def main():
176
  st.header("Cancel Job")
177
  cancel_session_id = st.text_input("Enter the session ID to cancel:")
178
  if st.button("Cancel Job"):
179
- if cancel_session_id in status_dict:
180
- cancel_job(cancel_session_id)
181
  st.success(f"Job {cancel_session_id} has been cancelled.")
182
  else:
183
- st.warning("Invalid session ID.")
184
 
185
  with tabs[3]:
186
  st.header("Job Table")
 
187
  job_data = [{"Job ID": job_id, **details} for job_id, details in status_dict.items()]
188
  st.table(job_data)
189
 
 
190
  if __name__ == "__main__":
191
  main()
192
 
 
11
  import re
12
  import threading
13
  import psutil
14
+ from video_processor import process_video, get_status, get_error_details, status_dict, cancel_job, cleanup_cancelled_jobs
15
 
16
 
17
  st.set_page_config(layout="wide")
 
176
  st.header("Cancel Job")
177
  cancel_session_id = st.text_input("Enter the session ID to cancel:")
178
  if st.button("Cancel Job"):
179
+ if cancel_job(cancel_session_id):
 
180
  st.success(f"Job {cancel_session_id} has been cancelled.")
181
  else:
182
+ st.warning("Invalid session ID or job already completed.")
183
 
184
  with tabs[3]:
185
  st.header("Job Table")
186
+ cleanup_cancelled_jobs() # Clean up cancelled jobs before displaying the table
187
  job_data = [{"Job ID": job_id, **details} for job_id, details in status_dict.items()]
188
  st.table(job_data)
189
 
190
+
191
  if __name__ == "__main__":
192
  main()
193