hatmanstack commited on
Commit
f970592
·
1 Parent(s): f52eacd
Files changed (6) hide show
  1. .gitignore +13 -0
  2. Dockerfile +16 -0
  3. README.md +141 -3
  4. banner.png +0 -0
  5. main.py +55 -0
  6. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules/
2
+ .expo/
3
+ yarn.lock
4
+ .env
5
+ app.json
6
+ package-lock.json
7
+ __pycache__/
8
+
9
+ # macOS
10
+ .DS_Store
11
+
12
+ # Temporary files created by Metro to check the health of the file watcher
13
+ .metro-health-check*
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ # Copy the FastAPI application
10
+ COPY main.py .
11
+
12
+ # Expose the port
13
+ EXPOSE 7860
14
+
15
+ # Command to run the application
16
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,10 +1,148 @@
1
  ---
2
  title: Float
3
- emoji:
4
  colorFrom: red
5
- colorTo: pink
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Float
3
+ emoji: 🔥
4
  colorFrom: red
5
+ colorTo: blue
6
  sdk: docker
7
  pinned: false
8
+ license: mit
9
  ---
10
 
11
+ <h1 align="center">
12
+ <img width="800" src="banner.png" alt="float-app icon">
13
+ </h1>
14
+ <h4 align="center">
15
+ <a href="https://www.apache.org/licenses/LICENSE-2.0.html">
16
+ <img src="https://img.shields.io/badge/license-Apache2.0-blue" alt="float is under the Apache 2.0 liscense" />
17
+ </a>
18
+ <a href="https://github.com/circlemind-ai/fast-graphrag/blob/main/CONTRIBUTING.md">
19
+ <img src="https://img.shields.io/badge/Expo-51+-green" alt="Expo Version" />
20
+ </a>
21
+ <a href="https://cloud.google.com/text-to-speech/docs/basics">
22
+ <img src="https://img.shields.io/badge/Google%20TTS%20>=2.6-yellow" alt="Google Text-To-Speech" />
23
+ </a>
24
+ <a href="https://platform.openai.com/docs/guides/text-to-speech">
25
+ <img src="https://img.shields.io/badge/OpenAI-voilet" alt="OpenAI Text-To-Speech" />
26
+ </a>
27
+ <img src="https://img.shields.io/youtube/views/8hmrio2A5Og">
28
+ <img src="https://img.shields.io/badge/python->=3.12.1-blue">
29
+ </h4>
30
+ <p align="center">
31
+ <p align="center"><b>From feelings to Flow - Customized Meditations <br> <a href="https://float-app.fun/"> FLOAT » </a> </b> </p>
32
+ </p>
33
+
34
+ # Float
35
+
36
+ Float is a cross-platform meditation app built with React Native and Expo. It uses Google Generative AI, Eleven Labs text-to-Speech (migrating to Google TTS), and a library of sound files to create personalized meditation experiences based on user-submitted incidents that have affected them emotionally, which we refer to as "floats". Floats are categorized by emotion and intensity, and include a timer and a color scheme to indicate the duration, summary, and reasoning behind each meditation. The app can generate meditations from up to three floats at a time.
37
+
38
+ ## Features :zap:
39
+
40
+ - **Personalized Meditations**: Generates customized meditation sessions based on user-submitted floats.
41
+ - **Multi-Platform Support**: Built with React Native and Expo, supporting iOS, Android and Web platforms.
42
+ - **Create Floats with Audio and Text**: User can create floats with audio or text allowing Gemini to capture tonality and speech patterns to asses mood and intensity of emotion as well as text
43
+ - **Google Generative AI Integration**: Utilizes Google Generative AI for generating floats and meditation content.
44
+ - **ElevenLabs Text-to-Speech**: Converts generated text into spoken meditations using ElevenLabs' text-to-speech technology.
45
+ - **Color-Coded Timer**: Provides a visual timer with a color scheme to indicate the elapsed time of the meditation session.
46
+ - **Emotion and Intensity Categorization**: Categorizes floats by emotion and intensity to tailor meditation experiences.
47
+ - **Backend Powered by AWS Lambda**: Manages API calls to Google Generative AI and ElevenLabs through AWS Lambda functions.
48
+
49
+ # Installation :eyes:
50
+
51
+ To set up and run Float locally, follow these steps:
52
+
53
+ ### Prerequisites
54
+
55
+ - Node.js (version 14 or higher)
56
+ - Expo CLI (install with `npm install -g expo-cli`)
57
+ - A Google Cloud account with API access for Generative AI
58
+ - An ElevenLabs account with API access for Text-to-Speech
59
+ - OpenAI Account and API key
60
+ - AWS account with Lambda functions set up
61
+
62
+ ### Clone the Repository
63
+
64
+ ```bash
65
+ git clone https://github.com/yourusername/float.git
66
+ cd float
67
+ ```
68
+
69
+ ### Install Dependencies
70
+ ```bash
71
+ yarn
72
+ ```
73
+
74
+ ## Configure Environment Variables
75
+ Create a .env file in the root directory and add the following variables:
76
+
77
+ Frontend
78
+ ```bash
79
+ EXPO_PUBLIC_AWS_ID=<aws_id>
80
+ EXPO_PUBLIC_AWS_SECRET=<aws_secret>
81
+ EXPO_PUBLIC_AWS_REGION=<aws_region>
82
+ ```
83
+
84
+ Backend
85
+ ```bash
86
+ FFMPEG_BINARY=/opt/bin/ffmpeg
87
+ G_KEY=<google_api_key>
88
+ SIMILARITY_BOOST=0.7
89
+ STABILITY=0.3
90
+ STYLE=0.3
91
+ VOICE_ID=jKX50Q2OBT1CsDwwcTkZ
92
+ XI_KEY=<eleven_labs_key>
93
+ OPENAI_API_KEY=<openai_key>
94
+ ```
95
+
96
+ # Run the App :smile:
97
+
98
+ ### Frontend
99
+
100
+ Start the development server:
101
+
102
+ ```bash
103
+ npm start -c
104
+ ```
105
+ This will open the metro builder. You can run the app on iOS, Android, or web
106
+
107
+ ### Backend
108
+
109
+ Create a Lambda Layer for the FFMPEG subprocess. Thanks to [SARVESH VIRKUD](https://virkud-sarvesh.medium.com/building-ffmpeg-layer-for-a-lambda-function-a206f36d3edc)
110
+
111
+ The Lambda packages need to be downloaded and built on a Linux machine with python 3.12 for google.protbuf and crypto binary packages to work correctly
112
+
113
+ ## Usage
114
+
115
+ - **Add Floats:** Enter incidents with audio or text that have affected you.
116
+ - **Review:** Review the summary and reasoning behind the float-generation.
117
+ - **Timing:** Use the color-coded timer to monitor if enough temporal space has been created.
118
+ - **Generate Meditation:** Select up to three floats to create a personalized meditation.
119
+ - **Start Meditation:** Begin the meditation session.
120
+
121
+ ## API Integration :fire:
122
+
123
+ - **Google Generative AI:** Used for generating the content of the meditations.
124
+ - **AWS Lambda:** Manages API calls and processes data from Google and ElevenLabs APIs.
125
+
126
+ **Choice of Voice API:** Converts generated text into audio for the meditation sessions.
127
+ - **ElevenLabs**
128
+ - **Google TTS**
129
+ - **OpenAI Text-to-Speech**
130
+
131
+
132
+ ## License
133
+ This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
134
+
135
+ ## Acknowledgements
136
+
137
+ **Google Icons:** Material Icons provided by Google Material Icons
138
+
139
+ **Logo Font:** Font provided by notyourtypefoundry testType(1.1)
140
+
141
+ ## Contact
142
+ For questions or feedback, please contact:
143
+
144
+ - Email: [email protected]
145
+ - GitHub: https://github.com/hatmanstack
146
+ - Twitter: @hatmanstack
147
+
148
+ Enjoy your meditative journey with Float!
banner.png ADDED
main.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from fastapi.responses import HTMLResponse
3
+ from fastapi.middleware.cors import CORSMiddleware
4
+
5
+ app = FastAPI()
6
+
7
+ # Add CORS middleware
8
+ app.add_middleware(
9
+ CORSMiddleware,
10
+ allow_origins=["*"],
11
+ allow_credentials=True,
12
+ allow_methods=["*"],
13
+ allow_headers=["*"],
14
+ )
15
+
16
+ @app.get("/", response_class=HTMLResponse)
17
+ async def read_root():
18
+ html_content = """
19
+ <!DOCTYPE html>
20
+ <html>
21
+ <head>
22
+ <title>Fullscreen IFrame</title>
23
+
24
+ <style>
25
+ body {
26
+ background-color: #333; /* Charcoal background */
27
+ color: #fff; /* White text color for contrast */
28
+ font-family: Arial, sans-serif;
29
+ margin: 0;
30
+ padding: 20px;
31
+ }
32
+ h1 {
33
+ font-size: 2em;
34
+ text-align: center;
35
+ transition: font-size 0.3s ease;
36
+ }
37
+ h1:hover {
38
+ font-size: 3em;
39
+ }
40
+ a {
41
+ color: #EA3C53;
42
+ text-decoration: none;
43
+ }
44
+ a:hover {
45
+ text-decoration: none;
46
+ }
47
+ </style>
48
+ </head>
49
+ <body>
50
+ <h1><a href="https://float-app.fun/">fLoAt</h1>
51
+
52
+ </body>
53
+ </html>
54
+ """
55
+ return HTMLResponse(content=html_content)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn