James Edmunds commited on
Commit
ee63789
·
1 Parent(s): 3ee10af

test: Initial minimal test setup

Browse files
Files changed (3) hide show
  1. README.md +3 -143
  2. app.py +1 -2
  3. requirements.txt +1 -13
README.md CHANGED
@@ -1,152 +1,12 @@
1
  ---
2
- title: SongLift LyrGen2
3
  emoji: 🎵
4
- colorFrom: indigo
5
- colorTo: purple
6
  sdk: streamlit
7
  sdk_version: 1.25.0
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- # SongLift LyrGen2
13
 
14
- An AI-powered lyric generator using LangChain and RAG (Retrieval-Augmented Generation) technology. This application leverages OpenAI's models and a database of existing lyrics to generate new, contextually-aware song lyrics with modern pop and hip-hop sensibilities.
15
-
16
- ## Features
17
-
18
- - **RAG-based Lyric Generation**: Uses a vector database of existing lyrics to inform new lyric creation
19
- - **Interactive Chat Interface**: Streamlit-based UI for real-time lyric generation
20
- - **Source Attribution**: Shows reference songs that influenced the generated lyrics with similarity scores
21
- - **Persistent Vector Storage**: Saves embeddings for faster subsequent runs using ChromaDB
22
- - **Intelligent Chunking**: Optimized text splitting (300 chars, 75 overlap) for lyrical content
23
- - **Rate Limit Handling**: Built-in retry logic for API rate limits with exponential backoff
24
- - **Smart Text Processing**:
25
- - Automatic encoding detection
26
- - Cleanup of common lyric file artifacts
27
- - Batch processing for large datasets
28
- - **Modern Lyric Style**: Specialized prompting for contemporary pop and hip-hop structures
29
-
30
- ## Development Environments
31
-
32
- ### Local Development
33
- 1. Clone the repository:
34
- ```bash
35
- git clone [repository-url]
36
- cd SongLift_LyrGen2
37
- ```
38
-
39
- 2. Create and activate virtual environment:
40
- ```bash
41
- python -m venv .venv
42
- source .venv/bin/activate # On Windows: .venv\Scripts\activate
43
- ```
44
-
45
- 3. Install dependencies:
46
- ```bash
47
- pip install -r requirements.txt
48
- ```
49
-
50
- 4. Set up environment variables:
51
- ```bash
52
- cp .env.example .env
53
- # Add your OpenAI API key to .env
54
- # Set DEPLOYMENT_MODE=local in .env
55
- ```
56
-
57
- 5. Start the application:
58
- ```bash
59
- streamlit run app.py
60
- ```
61
-
62
- ### HuggingFace Space Deployment
63
- 1. Set up HF Space environment variables:
64
- - `DEPLOYMENT_MODE=huggingface`
65
- - `OPENAI_API_KEY=your-api-key`
66
-
67
- 2. Configure HF Dataset:
68
- - Dataset name: `SongLift/LyrGen2_DB`
69
- - Structure:
70
- ```
71
- /chroma/ # ChromaDB files directly in root
72
- ```
73
-
74
- 3. Update Space settings:
75
- - SDK: streamlit
76
- - Python version: 3.11
77
- - Requirements: requirements.txt
78
-
79
- ## Project Structure
80
- ```
81
- songlift_lyrgen/
82
- ├── .streamlit/
83
- │ └── config.toml # Streamlit configuration
84
- ├── app.py # Main Streamlit application
85
- ├── src/
86
- │ └── generator/
87
- │ └── generator.py # Core lyric generation logic
88
- ├── config/
89
- │ └── settings.py # Environment-aware configuration
90
- ├── data/ # Local development data
91
- │ ├── raw/
92
- │ │ └── lyrics/ # Source lyrics files
93
- │ └── processed/
94
- │ └── embeddings/ # Local embeddings storage
95
- └── requirements.txt # Python dependencies
96
- ```
97
-
98
- ## Configuration
99
-
100
- ### Environment Variables
101
- - `DEPLOYMENT_MODE`: Set to 'local' or 'huggingface'
102
- - `OPENAI_API_KEY`: Your OpenAI API key
103
-
104
- ### Vector Store Settings
105
- - Local path: `data/processed/embeddings`
106
- - HF Space path: `/data/chroma`
107
- - Collection name: "lyrics"
108
-
109
- ### Model Parameters
110
- - Temperature: 0.9 (creative generation)
111
- - Top-p: 0.95 (diverse vocabulary)
112
- - Presence Penalty: 0.0
113
- - Frequency Penalty: 0.1
114
-
115
- ## Development Workflow
116
-
117
- 1. Create feature branch:
118
- ```bash
119
- git checkout -b feature/your-feature-name
120
- ```
121
-
122
- 2. Make changes and test locally:
123
- ```bash
124
- streamlit run app.py
125
- ```
126
-
127
- 3. Commit and push changes:
128
- ```bash
129
- git add .
130
- git commit -m "feat: your feature description"
131
- git push origin feature/your-feature-name
132
- ```
133
-
134
- 4. Deploy to HF Space:
135
- - Push to main branch
136
- - Space will auto-deploy
137
-
138
- ## Troubleshooting
139
-
140
- ### Local Development
141
- - Check `.env` file has `DEPLOYMENT_MODE=local`
142
- - Verify embeddings in `data/processed/embeddings`
143
- - Run with `--debug` flag: `streamlit run app.py --debug`
144
-
145
- ### HF Space
146
- - Verify `DEPLOYMENT_MODE=huggingface` in Space variables
147
- - Check dataset structure in `SongLift/LyrGen2_DB`
148
- - Review Space logs for path resolution
149
-
150
- ## License
151
-
152
- [Your License Here]
 
1
  ---
2
+ title: Test App
3
  emoji: 🎵
 
 
4
  sdk: streamlit
5
  sdk_version: 1.25.0
6
  app_file: app.py
7
  pinned: false
8
  ---
9
 
10
+ # Test Streamlit App
11
 
12
+ A minimal test app to verify Streamlit functionality.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
@@ -1,5 +1,4 @@
1
  """Main Streamlit application for lyric generation."""
2
  import streamlit as st
3
 
4
- st.title("Test App")
5
- st.write("Hello, World!")
 
1
  """Main Streamlit application for lyric generation."""
2
  import streamlit as st
3
 
4
+ st.write("Hello World!")
 
requirements.txt CHANGED
@@ -1,13 +1 @@
1
- langchain>=0.1.0
2
- langchain-openai>=0.0.2
3
- langchain-community>=0.0.16
4
- langchain-chroma>=0.0.5
5
- chromadb>=0.4.22
6
- streamlit==1.32.0
7
- python-dotenv==1.0.1
8
- huggingface-hub>=0.19.4
9
- pytest>=7.4.0
10
- black>=23.0.0
11
- flake8>=6.0.0
12
- numpy>=1.24.0
13
- chardet>=5.0.0
 
1
+ streamlit==1.25.0