Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,16 @@
|
|
| 1 |
-
from flask import Flask
|
| 2 |
|
|
|
|
| 3 |
app = Flask(__name__)
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
# Go to the end of file
|
| 14 |
-
f.seek(0, 2)
|
| 15 |
-
while True:
|
| 16 |
-
line = f.readline()
|
| 17 |
-
if line:
|
| 18 |
-
yield line + "<br>"
|
| 19 |
-
except Exception as e:
|
| 20 |
-
yield f"Error reading log: {e}"
|
| 21 |
-
return Response(generate(), mimetype="text/html")
|
| 22 |
-
|
| 23 |
-
if __name__ == "__main__":
|
| 24 |
-
app.run(host="0.0.0.0", port=7860)
|
|
|
|
| 1 |
+
from flask import Flask
|
| 2 |
|
| 3 |
+
# Create a Flask web application
|
| 4 |
app = Flask(__name__)
|
| 5 |
|
| 6 |
+
# This is the main page. It will respond to Hugging Face's health checks.
|
| 7 |
+
@app.route('/')
|
| 8 |
+
def health_check():
|
| 9 |
+
# You can customize this message
|
| 10 |
+
return "This page keeps the Minecraft server's Hugging Face Space alive. The server is running in the background!"
|
| 11 |
|
| 12 |
+
# This runs the web server.
|
| 13 |
+
if __name__ == '__main__':
|
| 14 |
+
# It listens on all network interfaces (0.0.0.0) and on port 7860,
|
| 15 |
+
# which is the default port for Hugging Face Spaces.
|
| 16 |
+
app.run(host='0.0.0.0', port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|