Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jupyter==1.0.0
# matplotlib==3.2.2
numpy==2.0.0
pandas==2.2.2
pip == 22.3.1
pip==22.3.1
torch==2.4.1
torchaudio
torchtext
Expand All @@ -13,4 +13,4 @@ flask
python-dotenv==1.0.1
scikit-learn==1.5.2
scipy==1.14.1
psycopg2-binary==2.9.10
psycopg2-binary==2.9.10
27 changes: 24 additions & 3 deletions run_training_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,28 @@
from src import process_data
import os
import shutil
import socket
app = Flask(__name__)

def print_connection_instructions(port):
hostname = socket.gethostname()
local_ip = socket.gethostbyname(hostname)
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
lan_ip = s.getsockname()[0]
s.close()
except Exception:
lan_ip = local_ip
print("\n" + "="*60)
print("Flask server is starting!\n")
print(f"Paste this address into the Uri field in Unity if you’re using the Meta XR Simulator on your computer, or a headset plugged into your computer in Link Mode:\n")
print(f" http://127.0.0.1:{port}\n")
print(f"Paste this address into the Uri field in Unity if you’re using an unplugged headset on the same WiFi network as your computer:\n")
print(f" http://{lan_ip}:{port}\n")
print("="*60 + "\n")



@app.route('/train_model_one_hand/', methods=['POST'])
def train_mode_one_hand():
Expand Down Expand Up @@ -44,6 +64,7 @@ def clearServerData():





app.run(port="8080", host="0.0.0.0", debug=True)
if __name__ == "__main__":
port = 8080
print_connection_instructions(port)
app.run(port=port, host="0.0.0.0", debug=True)