bluuebunny commited on
Commit
eb2e5c8
·
verified ·
1 Parent(s): e8bb333

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -2,6 +2,11 @@ import subprocess # Run update_embeddings.py as subprocess
2
  import time # Run update_embeddings.py periodically
3
  import threading # in a separate thread
4
  import gradio as gr # Create a Gradio interface so spaces doesnt timeout
 
 
 
 
 
5
 
6
  # Function to run update_embeddings.py periodically
7
  def run_script_periodically(interval):
@@ -11,9 +16,13 @@ def run_script_periodically(interval):
11
 
12
  while True:
13
 
 
 
14
  # Run run.py as a subprocess
15
  subprocess.run(["python", "update_embeddings.py"]) # Use "python3" if needed
16
 
 
 
17
  # Wait for the specified interval before running again
18
  time.sleep(interval)
19
 
 
2
  import time # Run update_embeddings.py periodically
3
  import threading # in a separate thread
4
  import gradio as gr # Create a Gradio interface so spaces doesnt timeout
5
+ from datetime import datetime
6
+
7
+ def log_message(message):
8
+ # Print message with a timestamp
9
+ print(f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - {message}")
10
 
11
  # Function to run update_embeddings.py periodically
12
  def run_script_periodically(interval):
 
16
 
17
  while True:
18
 
19
+ log_message("Starting Updation")
20
+
21
  # Run run.py as a subprocess
22
  subprocess.run(["python", "update_embeddings.py"]) # Use "python3" if needed
23
 
24
+ log_message("Finished run.py")
25
+
26
  # Wait for the specified interval before running again
27
  time.sleep(interval)
28