olamasp commited on
Commit
f0147fe
·
verified ·
1 Parent(s): 8762b89

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +26 -0
main.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask
2
+ import threading
3
+ import time
4
+ import os
5
+
6
+ app = Flask(__name__)
7
+
8
+ @app.route('/')
9
+ def home():
10
+ return "9Router Monitoring System is Active"
11
+
12
+ def monitor_logic():
13
+ while True:
14
+ # Di sinilah logika pemantauan 9 router kamu bekerja
15
+ print("Memantau status 9 router secara real-time...")
16
+ time.sleep(60)
17
+
18
+ if __name__ == '__main__':
19
+ # Jalankan logika monitoring di background
20
+ t = threading.Thread(target=monitor_logic)
21
+ t.daemon = True
22
+ t.start()
23
+
24
+ # Jalankan web server pada port 7860 untuk Hugging Face
25
+ port = int(os.environ.get("PORT", 7860))
26
+ app.run(host='0.0.0.0', port=port)