Spaces:
Paused
Paused
Kastg
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
from flask import Flask, request, jsonify, send_from_directory
|
| 2 |
import os
|
| 3 |
-
import requests
|
| 4 |
-
import json
|
| 5 |
import psutil
|
| 6 |
import time
|
| 7 |
import datetime
|
|
@@ -17,7 +15,7 @@ def index():
|
|
| 17 |
|
| 18 |
@app.route('/ai')
|
| 19 |
def ai():
|
| 20 |
-
return send_from_directory(static_dir, 'views
|
| 21 |
|
| 22 |
@app.route('/info')
|
| 23 |
def info():
|
|
@@ -60,24 +58,5 @@ def status():
|
|
| 60 |
def page_not_found(e):
|
| 61 |
return send_from_directory(static_dir, '404.html'), 404
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
# Get system uptime using psutil
|
| 66 |
-
uptime_seconds = int(time.time() - psutil.boot_time())
|
| 67 |
-
uptime_string = str(datetime.timedelta(seconds=uptime_seconds))
|
| 68 |
-
return jsonify({"uptime": uptime_string})
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
@app.route("/ping")
|
| 72 |
-
def ping():
|
| 73 |
-
# Ping an external service
|
| 74 |
-
try:
|
| 75 |
-
response = requests.get("https://example.com") # Change this to your desired external service
|
| 76 |
-
response.raise_for_status()
|
| 77 |
-
return jsonify({"ping": "success"})
|
| 78 |
-
except requests.exceptions.RequestException as e:
|
| 79 |
-
return jsonify({"ping": f"failed: {str(e)}"}), 500
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
if __name__ == "__main__":
|
| 83 |
-
app.run(host="0.0.0.0", port=7860, debug=True)
|
|
|
|
| 1 |
from flask import Flask, request, jsonify, send_from_directory
|
| 2 |
import os
|
|
|
|
|
|
|
| 3 |
import psutil
|
| 4 |
import time
|
| 5 |
import datetime
|
|
|
|
| 15 |
|
| 16 |
@app.route('/ai')
|
| 17 |
def ai():
|
| 18 |
+
return send_from_directory(os.path.join(static_dir, 'views'), 'ai.html')
|
| 19 |
|
| 20 |
@app.route('/info')
|
| 21 |
def info():
|
|
|
|
| 58 |
def page_not_found(e):
|
| 59 |
return send_from_directory(static_dir, '404.html'), 404
|
| 60 |
|
| 61 |
+
if __name__ == '__main__':
|
| 62 |
+
app.run(port=25565)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|