Spaces:
Sleeping
Sleeping
Commit
·
e498871
1
Parent(s):
1e4cc38
test one
Browse files- Dockerfile +27 -0
- app.py +31 -0
- requirements.txt +2 -0
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# Set proper terminal environment for Textual
|
| 4 |
+
ENV TERM=xterm-256color
|
| 5 |
+
ENV COLORTERM=truecolor
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Install system dependencies
|
| 9 |
+
RUN apt-get update && apt-get install -y \
|
| 10 |
+
gcc \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Create app directory
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Copy requirements and install Python dependencies
|
| 17 |
+
COPY requirements.txt .
|
| 18 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy application files
|
| 21 |
+
COPY app.py .
|
| 22 |
+
|
| 23 |
+
# Expose the port that HF Spaces expects
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Run the server
|
| 27 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
"""
|
| 3 |
+
Minimal Textual-Serve app for Hugging Face Spaces
|
| 4 |
+
Serves the built-in Textual demo application
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from textual_serve.server import Server
|
| 8 |
+
|
| 9 |
+
def main():
|
| 10 |
+
# Use the built-in Textual demo as our test application
|
| 11 |
+
# This runs 'python -m textual' which shows the Textual demo
|
| 12 |
+
command = "python -m textual"
|
| 13 |
+
|
| 14 |
+
# Create server configured for HF Spaces
|
| 15 |
+
server = Server(
|
| 16 |
+
command=command,
|
| 17 |
+
host="0.0.0.0", # Accept connections from any IP
|
| 18 |
+
port=7860, # HF Spaces default port
|
| 19 |
+
title="Textual Demo on HF Spaces", # Browser tab title
|
| 20 |
+
# The public_url will be automatically set by HF Spaces
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
print("Starting Textual-Serve server...")
|
| 24 |
+
print(f"Serving command: {command}")
|
| 25 |
+
print(f"Server will be available on port 7860")
|
| 26 |
+
|
| 27 |
+
# Start serving
|
| 28 |
+
server.serve()
|
| 29 |
+
|
| 30 |
+
if __name__ == "__main__":
|
| 31 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
textual==0.86.2
|
| 2 |
+
textual-serve==1.1.0
|