Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python
|
| 2 |
-
"""
|
| 3 |
-
Textual-Serve app for Hugging Face Spaces
|
| 4 |
-
Serves the Textual Calculator example application
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
-
import os
|
| 8 |
-
from textual_serve.server import Server
|
| 9 |
-
|
| 10 |
-
def main():
|
| 11 |
-
# Default to calculator, but allow override via environment variable
|
| 12 |
-
app_choice = os.environ.get("TEXTUAL_APP", "calculator").lower()
|
| 13 |
-
|
| 14 |
-
if app_choice == "demo":
|
| 15 |
-
# Run the built-in Textual demo
|
| 16 |
-
command = "python -m textual"
|
| 17 |
-
title = "Textual Demo on HF Spaces"
|
| 18 |
-
else:
|
| 19 |
-
# Run the calculator example (default)
|
| 20 |
-
command = "python calculator.py"
|
| 21 |
-
title = "Textual Calculator on HF Spaces"
|
| 22 |
-
|
| 23 |
-
# Create server configured for HF Spaces
|
| 24 |
-
server = Server(
|
| 25 |
-
command=command,
|
| 26 |
-
host="0.0.0.0", # Accept connections from any IP
|
| 27 |
-
port=7860, # HF Spaces default port
|
| 28 |
-
title=title, # Browser tab title
|
| 29 |
-
# The public_url will be automatically set by HF Spaces
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
print("Starting Textual-Serve server...")
|
| 33 |
-
print(f"Serving: {title}")
|
| 34 |
-
print(f"Command: {command}")
|
| 35 |
-
print(f"Server will be available on port 7860")
|
| 36 |
-
|
| 37 |
-
# Start serving
|
| 38 |
-
server.serve()
|
| 39 |
-
|
| 40 |
-
if __name__ == "__main__":
|
| 41 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|