George-API commited on
Commit
87e4dc7
·
verified ·
1 Parent(s): 928b596

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -41,16 +41,13 @@ SPACE_NAME = os.getenv("HF_SPACE_NAME", "phi4training")
41
  # Function to start the training process
42
  def start_training():
43
  try:
44
- # Run the training script using HF's native logging
45
- process = subprocess.Popen(
46
- ["python", "run_cloud_training.py"],
47
- stdout=subprocess.PIPE,
48
- stderr=subprocess.PIPE,
49
- universal_newlines=True
50
- )
51
 
52
  # Log the start of training
53
  logger.info("Training started - Check Hugging Face logs for details")
 
54
 
55
  return """
56
  ✅ Training process initiated!
@@ -125,4 +122,5 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
125
  if __name__ == "__main__":
126
  # Start Gradio with minimal features
127
  logger.info("Starting research training dashboard")
 
128
  demo.launch(share=False)
 
41
  # Function to start the training process
42
  def start_training():
43
  try:
44
+ # Run the training script directly - IMPORTANT: Don't redirect output so container logs show
45
+ # Using nohup to ensure process continues even if web request ends
46
+ os.system("nohup python run_cloud_training.py > training.log 2>&1 &")
 
 
 
 
47
 
48
  # Log the start of training
49
  logger.info("Training started - Check Hugging Face logs for details")
50
+ print("Training process initiated! This will appear in Hugging Face logs.")
51
 
52
  return """
53
  ✅ Training process initiated!
 
122
  if __name__ == "__main__":
123
  # Start Gradio with minimal features
124
  logger.info("Starting research training dashboard")
125
+ print("Research training dashboard started - Logs will be visible here")
126
  demo.launch(share=False)