File size: 1,218 Bytes
350b54b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -e

echo "Starting user embedding model pipeline..."

# Check if model already exists
if [ -f "embeddings_output/model.pth" ]; then
  echo "Model already trained."
else
  # Check if input data exists
  if [ ! -f "$DATA_PATH" ] && [ ! -f "users.json" ]; then
    echo "Error: No data file found. Please mount a volume with users.json or set DATA_PATH."
    exit 1
  fi

  # Run the model generation script
  
  python3 generate_model_gpu.py
  echo "Process completed. Check embeddings_output directory for results."
fi

# Get the hostname or public URL if available (for Hugging Face Spaces)
if [ -n "$SPACE_ID" ]; then
  # If running in Hugging Face Spaces
  BASE_URL="https://${SPACE_ID}.hf.space"
else
  # If running locally or in generic Docker
  BASE_URL="http://localhost:7860"
fi

echo "=========================================================="
echo "Model is available for download at the following URLs:"
echo "${BASE_URL}/file=embeddings_output/model.pth"
echo "${BASE_URL}/file=embeddings_output/model_config.json"
echo "=========================================================="

# Start the web server to serve files
echo "Starting web server on port 7860..."
python3 -m http.server 7860