Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.1.0
title: Pen Pal AI
emoji: ๐ฎ
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: mit
Pen Pal AI - Letter Exchange
An experimental AI interface that reimagines conversational AI through the timeless metaphor of letter writing. Instead of rapid-fire chatbot exchanges, Pen Pal AI encourages thoughtful, long-form correspondence with an AI pen pal.
๐ฏ Concept
Traditional conversational AI is modeled after instant messaging - quick back-and-forth exchanges. Pen Pal AI explores a different paradigm:
- Asynchronous: Take your time composing thoughtful letters
- Long-form: Write detailed, context-rich prompts without worrying about length
- Single-turn focus: Each letter gets a complete, comprehensive response
- Relaxed correspondence: More like writing to a friend than querying a chatbot
โจ Features
- ๐ Letter-writing interface with serif fonts and comfortable styling
- ๐ฌ Automatic subject line generation for each conversation thread
- ๐ข Turn tracking - User Prompt 1, AI Reply 1, User Prompt 2, etc.
- ๐ Thread history showing all letters in chronological order
- ๐พ Markdown downloads for each letter (preserve your correspondence!)
- ๐ New conversation button to start fresh threads
๐ Quick Start
Local Installation
Clone the repository:
git clone https://github.com/danielrosehill/Penpal-AI.git cd Penpal-AISet up virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtConfigure API key:
cp .env.example .env # Edit .env and add your OpenAI API keyRun the application:
python app.pyOpen your browser to the URL shown in the terminal (typically
http://localhost:7860)
๐ API Key Setup
This application uses OpenAI's API. You'll need:
- An OpenAI API account (sign up here)
- An API key (get one here)
- Add the key to your
.envfile:OPENAI_API_KEY=sk-...your-key-here
๐ How to Use
- Compose your letter in the text area on the left
- Click "๐ฎ Send Letter"
- Your letter appears in the "Your Last Letter" section
- The AI's reply appears on the right side
- View the complete thread history at the bottom
- Download any letter using the ๐พ Download buttons
- Start a new conversation anytime with the ๐ button
๐ก Tips for Best Results
- Write naturally - compose as if writing to a thoughtful friend
- Provide context - since each letter is self-contained, include relevant background
- Ask complex questions - this format excels at exploring ideas in depth
- Take your time - this isn't instant messaging, it's correspondence
- Use voice-to-text - long-form prompts work wonderfully with STT
๐จ The Philosophy
This project explores what happens when we:
- Reject the chat interface paradigm
- Embrace asynchronous, thoughtful communication
- Encourage long-form, context-rich prompts
- Treat AI interaction more like correspondence than commands
The hypothesis: This approach might work better for certain types of thinking, exploration, and creative work.
๐ Deployment to Hugging Face
Option 1: Deploy via Hugging Face Spaces UI
- Go to Hugging Face Spaces
- Click "Create new Space"
- Choose "Gradio" as the SDK
- Upload
app.pyandrequirements.txt - Add your
OPENAI_API_KEYin Settings โ Repository Secrets - Your space will build and deploy automatically!
Option 2: Deploy via Git
- Create a new Space on Hugging Face
- Clone the Space repository:
git clone https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME cd SPACE_NAME - Copy files:
cp /path/to/Penpal-AI/app.py . cp /path/to/Penpal-AI/requirements.txt . - Commit and push:
git add app.py requirements.txt git commit -m "Initial deployment of Pen Pal AI" git push - Add
OPENAI_API_KEYin Space Settings โ Repository Secrets
๐ ๏ธ Technical Details
- Framework: Gradio 5.49.1
- LLM: OpenAI GPT-4o (for responses) and GPT-4o-mini (for subject generation)
- Language: Python 3.12+
- Deployment: Compatible with Hugging Face Spaces
๐ค Why This Exists
The creator discovered that long-form prompting, especially with voice-to-text input, produces better AI interactions than traditional chat. This interface explores that insight by creating a UI that encourages and celebrates long-form correspondence.
It sits between:
- Workflow AI (non-interactive, task-oriented)
- Conversational AI (interactive chat)
Creating a third category: Correspondence AI (conversational but asynchronous)
๐ฎ Future Ideas
- Email-style notifications when "letters arrive"
- Context truncation controls (experiment with memory vs. fresh-start)
- User-selectable AI "personalities" or writing styles
- Export entire threads as formatted PDFs
- Integration with actual email for true async correspondence
๐ License
MIT License
๐ Acknowledgments
Inspired by the art of letter writing and the belief that slower, more thoughtful communication can be powerful even (or especially) with AI.
๐ง Contact
For questions, suggestions, or to share your experience:
- Website: danielrosehill.com
- Email: public@danielrosehill.com
Built with โ๏ธ by Daniel Rosehill
