Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask
|
2 |
+
import subprocess
|
3 |
+
import threading
|
4 |
+
import time
|
5 |
+
|
6 |
+
app = Flask(__name__)
|
7 |
+
|
8 |
+
def run_main_script():
|
9 |
+
"""Function to run the main.py script with the specified arguments."""
|
10 |
+
subprocess.run(["nohup", "python3", "main.py", "-a", "2"])
|
11 |
+
|
12 |
+
@app.route('/')
|
13 |
+
def hello():
|
14 |
+
return "XEmpire Bot is running!"
|
15 |
+
|
16 |
+
if __name__ == '__main__':
|
17 |
+
# Start the main.py script in a separate thread
|
18 |
+
threading.Thread(target=run_main_script, daemon=True).start()
|
19 |
+
|
20 |
+
# Start the Flask web server
|
21 |
+
app.run(host='0.0.0.0', port=7860)
|