-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart_web_interface.py
More file actions
53 lines (44 loc) · 1.53 KB
/
Copy pathstart_web_interface.py
File metadata and controls
53 lines (44 loc) · 1.53 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""
Simple starter script for the RFC to FOL web interface.
"""
import os
import sys
import webbrowser
import subprocess
import time
import platform
def install_requirements():
print("Checking and installing requirements...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("Requirements installed successfully.")
return True
except subprocess.CalledProcessError:
print("Error installing requirements. Please install them manually: pip install -r requirements.txt")
return False
def start_server():
print("Starting the web server...")
print("The web interface will be available at: http://localhost:5000")
# Start the server process
server_process = subprocess.Popen([sys.executable, "web_app.py"])
# Wait a bit for the server to start
time.sleep(2)
# Open the web browser
print("Opening web browser...")
webbrowser.open("http://localhost:5000")
print("\nPress Ctrl+C to stop the server when you're done.")
try:
# Keep the script running until KeyboardInterrupt
server_process.wait()
except KeyboardInterrupt:
print("\nShutting down the server...")
server_process.terminate()
server_process.wait()
print("Server stopped. Goodbye!")
if __name__ == "__main__":
print("=" * 60)
print("RFC to FOL Converter - Web Interface Starter")
print("=" * 60)
if install_requirements():
start_server()