File size: 1,662 Bytes
1e4cc38
b46f063
 
1e4cc38
 
 
3c75a0a
1e4cc38
 
 
3c75a0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: Textual in a Space
emoji: 🖥️
colorFrom: indigo
colorTo: gray
sdk: docker
app_port: 7860
pinned: false
---

# Textual Calculator on Hugging Face Spaces

This Space demonstrates a fully functional calculator application built with [Textual](https://github.com/Textualize/textual) and served through [textual-serve](https://github.com/Textualize/textual-serve) on Hugging Face Spaces.

## What is this?

This Space runs a macOS-inspired calculator application as a Terminal User Interface (TUI) in your web browser. It showcases how sophisticated TUI applications can be deployed as web apps using Textual and Hugging Face Spaces.

## Calculator Features

- 🔢 Full arithmetic operations (addition, subtraction, multiplication, division)
- % Percentage calculations
- ± Sign toggling
- 🖱️ Click buttons with your mouse
- ⌨️ Use your keyboard for input
- 🎨 Beautiful macOS-inspired design
- 🚀 Real-time interaction via WebSockets

## How it works

1. The Docker container runs a textual-serve server on port 7860
2. The server spawns the Textual demo application as a subprocess
3. WebSocket connections handle bidirectional communication
4. Your browser displays the terminal interface

## Want to deploy your own Textual app?

Check out the [source code](https://huggingface.co/spaces/[your-username]/textual-serve/tree/main) to see how this Space is configured and adapt it for your own Textual applications!

## Resources

- [Textual Documentation](https://textual.textualize.io/)
- [Textual-Serve GitHub](https://github.com/Textualize/textual-serve)
- [HF Spaces Docker SDK](https://huggingface.co/docs/hub/spaces-sdks-docker)