Views
No views yet
1# Install dependencies
2pip install -r requirements.txt
3
4# Run web interface
5streamlit run app.py1# Run terminal interface
2python chat_terminal.pyenglish_char_rnn.pthROMEO:, HAMLET:, or JULIET:Available commands:
- generate <prompt> [length] [temperature]
- help
- quit
Example: generate "ROMEO: My love" 200 1.01git clone https://github.com/yourusername/shakespeare-ai-chat.git
2cd shakespeare-ai-chatpip install -r requirements.txtenglish_char_rnn.pth is in the project directory.1# Web interface
2streamlit run app.py
3
4# Terminal interface
5python chat_terminal.py| Interface | Generation Speed | Memory Usage |
|---|---|---|
| Web (CPU) | ~50 chars/sec | ~500MB |
| Web (GPU) | ~200 chars/sec | ~1GB |
| Terminal | ~100 chars/sec | ~300MB |
1# Build image
2docker build -t shakespeare-ai .
3
4# Run container
5docker run -p 8501:8501 shakespeare-aishakespeare-ai-chat/
├── app.py # Main web interface
├── chat_terminal.py # Terminal chat interface
├── web_interface.py # Alternative web interface
├── model.py # LSTM model definition
├── english_char_rnn.pth # Trained model
├── requirements.txt # Dependencies
├── Dockerfile # Container configuration
├── .streamlit/ # Streamlit config
└── README.md # This file.pth files in root directoryapp.py for web changeschat_terminal.py1# Ensure model file exists
2ls -la english_char_rnn.pth1# Reduce batch size or text length
2# Use CPU mode if GPU memory is limited1# Reinstall dependencies
2pip install -r requirements.txt --force-reinstall1# Create virtual environment
2python -m venv venv
3source venv/bin/activate # On Windows: venv\Scripts\activate
4
5# Install in development mode
6pip install -r requirements.txt