diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d56de6651e886d52b3b6faec772ef309b3eda1af --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM python:3.8.10-slim + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get -qq update \ + && apt install software-properties-common -y \ + && apt-get install build-essential -y \ + && python3 --version \ + && apt update \ + && apt install ffmpeg -y \ + && rm -rf /var/lib/apt/lists/* \ + && apt update \ + && apt install nginx -y + +### Set up user with permissions +# Set up a new user named "user" with user ID 1000 +RUN useradd -m -u 1000 user + +# Switch to the "user" user +USER user + +# Set home to the user's home directory +ENV HOME=/home/user \ + PATH=/home/user/.local/bin:$PATH + +# Set the working directory to the user's home directory +WORKDIR $HOME/app + +### Set up app-specific content +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt +RUN pip3 install gunicorn + +# Copy the current directory contents into the container at $HOME/app setting the owner to the user +COPY --chown=user app $HOME/app + +### Update permissions for the app +USER root +RUN chmod 755 ~/app/* +USER user + +# RUN python3 server.py +ENTRYPOINT ["python3", "app.py"] +# ENTRYPOINT ["gunicorn", "--timeout 600", "wsgi:app"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..29f81d812f3e768fa89638d1f72920dbfd1413a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f997a68836a1d5cbb825f26ec28530cf872a216d Binary files /dev/null and b/app/.DS_Store differ diff --git a/app/__pycache__/app.cpython-311.pyc b/app/__pycache__/app.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5c389a55998c7c4635fdc1ec898545041afc098 Binary files /dev/null and b/app/__pycache__/app.cpython-311.pyc differ diff --git a/app/__pycache__/emotion_data.cpython-311.pyc b/app/__pycache__/emotion_data.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4310b3a28e1c05681e67220195b219c76e4d3680 Binary files /dev/null and b/app/__pycache__/emotion_data.cpython-311.pyc differ diff --git a/app/app.py b/app/app.py new file mode 100644 index 0000000000000000000000000000000000000000..a82ff6ee81cf15a6a336caa6d2e370d560c3e821 --- /dev/null +++ b/app/app.py @@ -0,0 +1,148 @@ +import os +import uuid +import logging +from flask import Flask, flash, render_template, request, jsonify, url_for +from flask.templating import TemplateNotFound +from flask_cors import CORS +#from modules import Module + +#model = Module() + + +app = Flask(__name__) +CORS(app) + +app.secret_key = "Testing" +app.config['STATIC_FOLDER'] = 'static' + +emotion_categories = { + "admiration": "soothieanduplift", + "amusement": "soothieanduplift", + "anger": "distractandchange", + "annoyance": "distractandchange", + "approval": "soothieanduplift", + "caring": "soothieanduplift", + "confusion": "engageandexplore", + "curiosity": "engageandexplore", + "desire": "engageandexplore", + "disappointment": "reflectiveandunderstand", + "disapproval": "distractandchange", + "disgust": "distractandchange", + "embarrassment": "distractandchange", + "excitement": "energeticandmotivate", + "fear": "distractandchange", + "gratitude": "soothieanduplift", + "grief": "reflectiveandunderstand", + "joy": "energeticandmotivate", + "love": "soothieanduplift", + "nervousness": "distractandchange", + "optimism": "energeticandmotivate", + "pride": "energeticandmotivate", + "realization": "engageandexplore", + "relief": "soothieanduplift", + "remorse": "reflectiveandunderstand", + "sadness": "reflectiveandunderstand", + "surprise": "engageandexplore", + "neutral": "soothieanduplift" +} + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/audio_to_text/') +def audio_to_text(): + return render_template('audio_to_text.html') + +@app.route('/audio', methods=['POST', 'GET']) +def audio(): + if request.method == 'POST': + try: + output_file = f"./tmp/{uuid.uuid4()}.wav" + open(output_file, 'wb').write(request.data) + text, emotion = model.predict(audio_path=output_file) + os.remove(output_file) + + predicted_category = emotion_categories.get(emotion, "defaultcategory") + return jsonify({ + "url": url_for(predicted_category, text=text, emotion=emotion) + }) + print("Predicted Category:", predicted_category) # Print predicted category + print("Text:", text) # Print predicted text + print("Emotion:", emotion) # Print predicted emotion + logging.info("Predicted Category: %s", predicted_category) + logging.info("Text: %s", text) + logging.info("Emotion: %s", emotion) + return jsonify({"url": url_for(predicted_category)}) + + except (FileNotFoundError, TemplateNotFound) as e: + logging.error(e) + return jsonify({"error": "Template file not found."}), 404 + + except Exception as e: + logging.error(e) + return jsonify({"error": "An error occurred"}), 500 + + elif request.method == 'GET': + return jsonify({"message": "This route only accepts POST requests."}), 405 + + +@app.route('/reflectiveandunderstand', methods=['GET']) +def reflectiveandunderstand(): + text = request.args.get('text', '') # Get predicted text + emotion = request.args.get('emotion', '') # Get predicted emotion + if emotion in emotion_data: + emotionInfo = emotion_data[emotion] + return render_template('reflectiveandunderstand.html', text=text, emotion=emotion, emotionInfo=emotionInfo) + else: + return jsonify({"error": "Emotion not found"}), 404 + +@app.route('/distractandchange', methods=['GET']) +def distractandchange(): + text = request.args.get('text', '') # Get predicted text + emotion = request.args.get('emotion', '') # Get predicted emotion + if emotion in emotion_data: + emotionInfo = emotion_data[emotion] + return render_template('distractandchange.html', text=text, emotion=emotion, emotionInfo=emotionInfo) + else: + return jsonify({"error": "Emotion not found"}), 404@app.route('/energeticandmotivate', methods=['GET']) + +def energeticandmotivate(): + text = request.args.get('text', '') # Get predicted text + emotion = request.args.get('emotion', '') # Get predicted emotion + if emotion in emotion_data: + emotionInfo = emotion_data[emotion] + return render_template('energeticandmotivate.html', text=text, emotion=emotion, emotionInfo=emotionInfo) + else: + return jsonify({"error": "Emotion not found"}), 404@app.route('/energeticandmotivate', methods=['GET']) + +@app.route('/engageandexplore', methods=['GET']) +def engageandexplore(): + text = request.args.get('text', '') # Get predicted text + emotion = request.args.get('emotion', '') # Get predicted emotion + if emotion in emotion_data: + emotionInfo = emotion_data[emotion] + return render_template('engageandexplore.html', text=text, emotion=emotion, emotionInfo=emotionInfo) + else: + return jsonify({"error": "Emotion not found"}), 404@app.route('/energeticandmotivate', methods=['GET']) + +# Add more routes as needed, mirroring your category names +@app.route('/soothieanduplift', methods=['GET']) +def soothieanduplift(): + text = request.args.get('text', '') # Get predicted text + emotion = request.args.get('emotion', '') # Get predicted emotion + if emotion in emotion_data: + emotionInfo = emotion_data[emotion] + return render_template('soothieanduplift.html', text=text, emotion=emotion, emotionInfo=emotionInfo) + else: + return jsonify({"error": "Emotion not found"}), 404@app.route('/energeticandmotivate', methods=['GET']) + +# Add more routes as needed, mirroring your category names + + + +if __name__ == "__main__": + # Configure logging for Hugging Face environment + logging.basicConfig(level=logging.DEBUG) + + app.run(debug=True, port=7860, host='0.0.0.0') diff --git a/app/emotion_data.py b/app/emotion_data.py new file mode 100644 index 0000000000000000000000000000000000000000..b58bd1d4e343859f1f742b6a6f776ccf27e3f3b0 --- /dev/null +++ b/app/emotion_data.py @@ -0,0 +1,170 @@ +emotion_data = { + "admiration": { + 'heading': "Time to appreciate the beauty around you!", + 'info': "We've picked songs that uplift your mood and inspire feelings of wonder.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "amusement": { + 'heading': "Let's have some fun! Get ready to laugh and lighten up.", + 'info': "This playlist features playful and lighthearted music to boost your mood.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "anger": { + 'heading': "Time to cool off!", + 'info': "Here are some tracks to help you release anger and find peace.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "annoyance": { + 'heading': "Feeling annoyed? Let's turn it around!", + 'info': "Listen to these tunes to shift your mood and find some relief.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "approval": { + 'heading': "Feel appreciated and acknowledged!", + 'info': "Enjoy these tracks that celebrate approval and acceptance.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "caring": { + 'heading': "Embrace feelings of care and compassion.", + 'info': "This playlist is all about fostering a sense of warmth and empathy.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "confusion": { + 'heading': "Embrace the confusion and explore!", + 'info': "Dive into these tracks to embrace curiosity and explore new perspectives.", + 'category': "engageandexplore", + 'class': "emotion-info emotion-heading" + }, + "curiosity": { + 'heading': "Fuel your curiosity with these tunes!", + 'info': "Feed your curiosity and thirst for knowledge with this eclectic playlist.", + 'category': "engageandexplore", + 'class': "emotion-info emotion-heading" + }, + "desire": { + 'heading': "Embrace your desires and passions!", + 'info': "Indulge in these tracks that ignite feelings of longing and passion.", + 'category': "engageandexplore", + 'class': "emotion-info emotion-heading" + }, + "disappointment": { + 'heading': "Feeling disappointed? You're not alone.", + 'info': "Reflect and understand with these songs that capture the essence of disappointment.", + 'category': "reflectiveandunderstand", + 'class': "emotion-info emotion-heading" + }, + "disapproval": { + 'heading': "Shake off disapproval and find your groove.", + 'info': "Listen to these tunes to uplift your spirits and brush off negativity.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "disgust": { + 'heading': "Time to cleanse your palate!", + 'info': "Find solace in these tracks that help you move past feelings of disgust.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "embarrassment": { + 'heading': "Embrace the embarrassment and move forward!", + 'info': "Listen to these tunes to shake off embarrassment and regain confidence.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "excitement": { + 'heading': "Get ready to be pumped up!", + 'info': "Feel the energy with these high-octane tracks that fuel excitement.", + 'category': "energeticandmotivate", + 'class': "emotion-info emotion-heading" + }, + "fear": { + 'heading': "Facing fear head-on!", + 'info': "Conquer your fears with these empowering tracks that inspire courage.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "gratitude": { + 'heading': "Feel grateful and blessed!", + 'info': "Express gratitude with these heartfelt tunes that inspire thankfulness.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "grief": { + 'heading': "Navigating through grief and loss.", + 'info': "Reflect and understand with these poignant songs that capture the essence of grief.", + 'category': "reflectiveandunderstand", + 'class': "emotion-info emotion-heading" + }, + "joy": { + 'heading': "Let joy fill your heart!", + 'info': "Experience pure bliss with these uplifting tracks that radiate joy.", + 'category': "energeticandmotivate", + 'class': "emotion-info emotion-heading" + }, + "love": { + 'heading': "Celebrate love in all its forms!", + 'info': "Get lost in these romantic tunes that celebrate the beauty of love.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "nervousness": { + 'heading': "Embrace the nerves and stay strong!", + 'info': "Find calmness and strength with these soothing tracks that ease nervousness.", + 'category': "distractandchange", + 'class': "emotion-info emotion-heading" + }, + "optimism": { + 'heading': "Stay positive and optimistic!", + 'info': "Fuel your optimism with these uplifting tunes that inspire positivity.", + 'category': "energeticandmotivate", + 'class': "emotion-info emotion-heading" + }, + "pride": { + 'heading': "Feel proud of your achievements!", + 'info': "Celebrate your accomplishments with these triumphant tunes that exude pride.", + 'category': "energeticandmotivate", + 'class': "emotion-info emotion-heading" + }, + "realization": { + 'heading': "Embrace newfound realizations!", + 'info': "Explore new insights and perspectives with these thought-provoking tunes.", + 'category': "engageandexplore", + 'class': "emotion-info emotion-heading" + }, + "relief": { + 'heading': "Find relief and comfort!", + 'info': "Experience a sense of relief and relaxation with these calming tracks.", + 'category': "soothieanduplift", + 'class': "emotion-info emotion-heading" + }, + "remorse": { + 'heading': "Reflecting on remorse and learning.", + 'info': "Reflect and understand with these introspective tunes that delve into remorse.", + 'category': "reflectiveandunderstand", + 'class': "emotion-info emotion-heading" + }, + "sadness": { + 'heading': "Embrace the sadness and find solace.", + 'info': "Navigate through feelings of sadness with these comforting tracks.", + 'category': "reflectiveandunderstand", + 'class': "emotion-info emotion-heading" + }, + "surprise": { + 'heading': "Expect the unexpected!", + 'info': "Embrace the element of surprise with these unpredictable tracks.", + 'category': "engageandexplore", + 'class': "emotion-info emotion-heading" + }, + "neutral": { + 'heading': "Find balance and neutrality.", + 'info': "Stay grounded with these tranquil tracks that embody neutrality.", + 'category': "soothieanduplift", + 'class':"emotion-info emotion-heading" + } +} diff --git a/app/modules/.DS_Store b/app/modules/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1b3123162eda2b4a3678d185109c46cb1d7376a5 Binary files /dev/null and b/app/modules/.DS_Store differ diff --git a/app/modules/__init__.py b/app/modules/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fe5a9651733fce5ee47f40f7e88710e01ab1eb28 --- /dev/null +++ b/app/modules/__init__.py @@ -0,0 +1,34 @@ +import os +import time + +from modules.emotion import Emotion +from modules.transcription import Transcription + +transcription_model = "tiny.en" +emotion_model = "joeddav/distilbert-base-uncased-go-emotions-student" + +transcription_obj = Transcription(model_name=transcription_model) +emotion_obj = Emotion(model_name=emotion_model) + +class Module: + + def predict(self, audio_path: str) -> str: + """Loads audio, gets transcription and detects emotion + + Args: + audio_path (str): path to the audio file + + Returns: + str: emotion + """ + print("Getting transcription...") + start_time = time.time() + if text := transcription_obj.transcribe(audio_path=audio_path): + print("Text: ", text, time.time() - start_time) + + start_time = time.time() + emotion = emotion_obj.detect_emotion(text=text) + print("Emotion: ", emotion, time.time() - start_time) + return text, emotion + return None + diff --git a/app/modules/__pycache__/__init__.cpython-310.pyc b/app/modules/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..107acaef688ea1ad8b83ad222d705670d7b1c37c Binary files /dev/null and b/app/modules/__pycache__/__init__.cpython-310.pyc differ diff --git a/app/modules/__pycache__/__init__.cpython-311.pyc b/app/modules/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cbc2e5f66cecb8650df3d0eadeb9248b2389360 Binary files /dev/null and b/app/modules/__pycache__/__init__.cpython-311.pyc differ diff --git a/app/modules/__pycache__/__init__.cpython-312.pyc b/app/modules/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1cfa85496f18a5c08516ba79e3d863887363f678 Binary files /dev/null and b/app/modules/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/modules/__pycache__/__init__.cpython-38.pyc b/app/modules/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f7970333d5e74851679e7421fe37f59e0864d14 Binary files /dev/null and b/app/modules/__pycache__/__init__.cpython-38.pyc differ diff --git a/app/modules/__pycache__/__init__.cpython-39.pyc b/app/modules/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81056cd568e72c650f1d5a030450e23343160b7e Binary files /dev/null and b/app/modules/__pycache__/__init__.cpython-39.pyc differ diff --git a/app/modules/__pycache__/utils.cpython-310(1).pyc b/app/modules/__pycache__/utils.cpython-310(1).pyc new file mode 100644 index 0000000000000000000000000000000000000000..52908f83efe6c1385b9411a69ace7042209bebeb Binary files /dev/null and b/app/modules/__pycache__/utils.cpython-310(1).pyc differ diff --git a/app/modules/__pycache__/utils.cpython-310.pyc b/app/modules/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1edd9f767211b9ac5848e581aadd7b631179ae9f Binary files /dev/null and b/app/modules/__pycache__/utils.cpython-310.pyc differ diff --git a/app/modules/__pycache__/utils.cpython-311.pyc b/app/modules/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f48789a148afc18faff8efd351ee03ca98888cd Binary files /dev/null and b/app/modules/__pycache__/utils.cpython-311.pyc differ diff --git a/app/modules/__pycache__/utils.cpython-312.pyc b/app/modules/__pycache__/utils.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1919f0b7338feafee162fb7dab57b636e2f8afae Binary files /dev/null and b/app/modules/__pycache__/utils.cpython-312.pyc differ diff --git a/app/modules/__pycache__/utils.cpython-38.pyc b/app/modules/__pycache__/utils.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..90fe3b44d97261b330742e8a6761e65a39d5d624 Binary files /dev/null and b/app/modules/__pycache__/utils.cpython-38.pyc differ diff --git a/app/modules/__pycache__/utils.cpython-39.pyc b/app/modules/__pycache__/utils.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e1eccb7df8af755d3bfdff0b85c725d209cf10b8 Binary files /dev/null and b/app/modules/__pycache__/utils.cpython-39.pyc differ diff --git a/app/modules/audio/__init__.py b/app/modules/audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..657cd81ccff78de4f9c3da16442ab57dc6ee5881 --- /dev/null +++ b/app/modules/audio/__init__.py @@ -0,0 +1,18 @@ +from typing import Any + +import whisper + + +class Audio: + @classmethod + def load_audio(cls, audio_path: str) -> Any: + """Loads audio file from the disk + + Args: + audio_path (str): path of the audio file + + Returns: + Any: loaded audio file in numbers + """ + return whisper.load_audio(audio_path) + \ No newline at end of file diff --git a/app/modules/audio/__pycache__/__init__.cpython-38.pyc b/app/modules/audio/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..92344e3c0a70d83bdc41a427459b5ef081e526c0 Binary files /dev/null and b/app/modules/audio/__pycache__/__init__.cpython-38.pyc differ diff --git a/app/modules/emotion/__init__.py b/app/modules/emotion/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..be101affbabbdb8904abe9bab249c2c5e7bba9d2 --- /dev/null +++ b/app/modules/emotion/__init__.py @@ -0,0 +1,24 @@ +from typing import Any + +from modules.utils import Pipeline, load_model + + +class Emotion: + task: str = "text-classification" + + def __init__(self, model_name: str) -> None: + # model_name: str = "/models/distilbert-base-uncased-go-emotions-student/" + print("Loading emotion model...") + self.emotion_model: Pipeline = load_model(task=self.task, model=model_name) + print("Loaded emotion model") + + def detect_emotion(self, text: str) -> str: + """Detects emotion of the given text + + Args: + text (str): text + + Returns: + str: emotion + """ + return self.emotion_model(text)[0]['label'] \ No newline at end of file diff --git a/app/modules/emotion/__pycache__/__init__.cpython-310.pyc b/app/modules/emotion/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..efe069e2e834d8ba6685e83ec18013fb67331b0d Binary files /dev/null and b/app/modules/emotion/__pycache__/__init__.cpython-310.pyc differ diff --git a/app/modules/emotion/__pycache__/__init__.cpython-311.pyc b/app/modules/emotion/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7165f9c86ba9c7b3157e950b8cab0ba073b066b7 Binary files /dev/null and b/app/modules/emotion/__pycache__/__init__.cpython-311.pyc differ diff --git a/app/modules/emotion/__pycache__/__init__.cpython-312.pyc b/app/modules/emotion/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6782eac4588f3a81b4f24c4dfd084103ded18e06 Binary files /dev/null and b/app/modules/emotion/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/modules/emotion/__pycache__/__init__.cpython-38.pyc b/app/modules/emotion/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9070fbf111a3929766f49983c771f75b685cef5 Binary files /dev/null and b/app/modules/emotion/__pycache__/__init__.cpython-38.pyc differ diff --git a/app/modules/emotion/__pycache__/__init__.cpython-39.pyc b/app/modules/emotion/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c65d126f53ec83cfd0e12ee831e08abebff1312 Binary files /dev/null and b/app/modules/emotion/__pycache__/__init__.cpython-39.pyc differ diff --git a/app/modules/transcription/__init__.py b/app/modules/transcription/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c8a008189db2a57231fb79dc9b3bc5b9a05bb2f5 --- /dev/null +++ b/app/modules/transcription/__init__.py @@ -0,0 +1,30 @@ +import torch +from faster_whisper import WhisperModel + + +class Transcription: + + def __init__(self, model_name: str) -> None: + print("Loading whisper model...") + self.whisper_model = self.load_whisper(model_id=model_name) + print("Loaded whisper model") + + def load_whisper(self, model_id: str): + + device = "cuda:0" if torch.cuda.is_available() else "cpu" + torch_dtype = "float16" if torch.cuda.is_available() else "float32" + + return WhisperModel(model_id, device=device, compute_type=torch_dtype) + + def transcribe(self, audio_path: str) -> str: + """Transcribes the given audio data + + Args: + audio_path (str): audio path + + Returns: + str: text + """ + segments, info = self.whisper_model.transcribe(audio_path, language="en") + return "".join(segment.text for segment in segments) + diff --git a/app/modules/transcription/__pycache__/__init__.cpython-311.pyc b/app/modules/transcription/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cc8ffb11032dbabb55af5dd03a8d65a5cb4f9030 Binary files /dev/null and b/app/modules/transcription/__pycache__/__init__.cpython-311.pyc differ diff --git a/app/modules/transcription/__pycache__/__init__.cpython-312.pyc b/app/modules/transcription/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21761158ded292ffb0f3dd9228b6501de88e8bad Binary files /dev/null and b/app/modules/transcription/__pycache__/__init__.cpython-312.pyc differ diff --git a/app/modules/transcription/__pycache__/__init__.cpython-38.pyc b/app/modules/transcription/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d84322389a1c03ff09f0d795c5cfb435d61ab30 Binary files /dev/null and b/app/modules/transcription/__pycache__/__init__.cpython-38.pyc differ diff --git a/app/modules/utils.py b/app/modules/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..b890c9bb8b494e05ae003753f5f1c07bdcf9c7e6 --- /dev/null +++ b/app/modules/utils.py @@ -0,0 +1,20 @@ +import torch +from transformers import pipeline +from transformers.pipelines.base import Pipeline + + +def load_model(task: str, model: str) -> Pipeline: + """Loads the given transformers model based on the given task + + Args: + task (str): NLP task + model (str): transformers model + + Returns: + Pipeline: transformers pipeline object + """ + return pipeline( + task=task, + model=model, + device = 0 if torch.cuda.is_available() else -1 + ) \ No newline at end of file diff --git a/app/static/audio_main.js b/app/static/audio_main.js new file mode 100644 index 0000000000000000000000000000000000000000..a078c0f62c93f302d5e6f8cbbe7f72ee1da6c5da --- /dev/null +++ b/app/static/audio_main.js @@ -0,0 +1,159 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Night Owl", + artist: "Broke For Free", + image: "https://images.pexels.com/photos/2264753/pexels-photo-2264753.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Broke_For_Free/Directionless_EP/Broke_For_Free_-_01_-_Night_Owl.mp3" + }, + { + name: "Enthusiast", + artist: "Tours", + image: "https://images.pexels.com/photos/3100835/pexels-photo-3100835.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/no_curator/Tours/Enthusiast/Tours_-_01_-_Enthusiast.mp3" + }, + { + name: "Shipping Lanes", + artist: "Chad Crouch", + image: "https://images.pexels.com/photos/1717969/pexels-photo-1717969.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/ccCommunity/Chad_Crouch/Arps/Chad_Crouch_-_Shipping_Lanes.mp3", + }, + { + name: "Starboy", + artist: "Weeknd", + image: "/static/weeknd.jpeg", + path: "/static/The Weeknd - Starboy ft.mp3", + }, + +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/static/audio_to_text.css b/app/static/audio_to_text.css new file mode 100644 index 0000000000000000000000000000000000000000..b4f7c747c117c7f718546847aa687de4154353b1 --- /dev/null +++ b/app/static/audio_to_text.css @@ -0,0 +1,135 @@ +body { + background: linear-gradient(to right, #0f4da6, #0f4da6, #1e272e, #1e272e); + margin: 0; /* Remove default body margin */ + padding: 0; /* Remove default body padding */ +} + +.container { + position: relative; +} + +.row { + background: linear-gradient(to right, #0f4da6, #0f4da6, #1e272e, #1e272e); + border-radius: 8px; + padding: 20px; + margin-bottom: 20px; + display: flex; /* Use Flexbox */ + justify-content: space-around; +} + +.column { + width: 45%; /* Adjust as needed */ + padding: 15px; + color: #f0f0f5; +} + +#recording-instructions { + text-align: left; + margin-top: 10px; + font-style: italic; +} + +.row { + display: flex; + flex-direction: column; /* Stack items vertically */ + align-items: left; + margin-bottom: 3%; + background-color: #060073; +} + +/* Clear floats after the columns */ +.row:after { + content: ""; + display: table; + clear: both; +} + +/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */ +@media screen and (max-width: 600px) { + .column1 { + width: 100%; + } +} + +@media screen and (max-width: 600px) { + .column2 { + width: 100%; + } +} + +#imgInp { + opacity: 0; + position: absolute; + z-index: -1; +} + +label { + cursor: pointer; + padding-left: 10%; + padding-right: 10%; + padding-top: 2%; + padding-bottom: 2%; + font-size: 100%; + color: #000000; + border-radius: 25px; + background-color: #228B22; +} + +#blah { + max-width: 60%; + max-height: 60%; +} + +#image_div1 { + max-width: 70%; + max-height: 70%; +} + +#stop, #start { + background-color: black; + color: white; + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; + margin: 10px; /* Add margin to create gap */ + transition: background-color 0.3s ease; /* Add transition for smooth effect */ +} + +#stop { + margin-right: 5px; /* Adjust margin to create gap */ +} + +#stop:hover, #start:hover { + background-color: #333; /* Change background color on hover */ +} + +.animated-title { + font-size: 2.5rem; + font-weight: bold; + color: white; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); + animation: fadeIn 2s forwards; + transition: color 0.5s ease-in-out, text-shadow 0.5s ease-in-out; + white-space: nowrap; + position: absolute; + left: 200px; /* Adjust the value as needed */ + top: 20px; +} + +@keyframes fadeIn { + 0% { + opacity: 0; + transform: translateY(-20px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} + +.animated-title:hover { + color: black; + text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8); +} + diff --git a/app/static/audiodisplay.js b/app/static/audiodisplay.js new file mode 100644 index 0000000000000000000000000000000000000000..a0d6a54e0f17f02031f92e4e160c1455e6158c67 --- /dev/null +++ b/app/static/audiodisplay.js @@ -0,0 +1,19 @@ +function drawBuffer( width, height, context, data ) { + var step = Math.ceil( data.length / width ); + var amp = height / 2; + context.fillStyle = "silver"; + context.clearRect(0,0,width,height); + for(var i=0; i < width; i++){ + var min = 1.0; + var max = -1.0; + for (j=0; j max) + max = datum; + } + context.fillRect(i,(1+min)*amp,1,Math.max(1,(max-min)*amp)); + } +} + diff --git a/app/static/dem.css b/app/static/dem.css new file mode 100644 index 0000000000000000000000000000000000000000..198b71532e804066bd3134d20ebd8adb3194202c --- /dev/null +++ b/app/static/dem.css @@ -0,0 +1,53 @@ +*{ + font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; + color: #171717; + background-color: antiquewhite; +} +header { + text-align: center; + +} +.grid-container { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 20px; + } + + .card { + border: 3px solid #f6a503; + border-radius: 8px; + overflow: hidden; + } + + .card img { + width: 100%; + height: 600px; + display: block; + } + + .card-content { + padding: 20px; + } + + .card-content h2 { + margin-top: 0; + } + + .card-content h4 { + margin-bottom: 10px; + } + + .card-content button { + background-color: #f6a503; + color: #000000; + border: none; + padding: 10px 20px; + border-radius: 5px; + cursor: pointer; + transition: background-color 0.3s ease; + } + + .card-content button:hover { + background-color: #ffffff; + } + \ No newline at end of file diff --git a/app/static/demo.css b/app/static/demo.css new file mode 100644 index 0000000000000000000000000000000000000000..2631fe38178c76a8cb6da13900171d43f7740ce8 --- /dev/null +++ b/app/static/demo.css @@ -0,0 +1,40 @@ +/* style.css */ +.audio-container { + display: flex; + flex-wrap: wrap; + justify-content: space-around; + background-color: #2caaf3 + } + + .audio-player { + width: 300px; + margin: 15px; + border: 1px solid #ccc; + padding: 15px; + border-radius: 8px; + text-align: center; + background-color: #0af32d; /* Light background color */ + box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow effect */ + } + + .audio-player:nth-child(odd) { + background-color: #c71a82; /* Alternating background */ + } + + .audio-image { + width: 100%; + height: 200px; + object-fit: cover; + border-radius: 8px; + } + + .audio-info { + margin-top: 10px; + } + + /* Hover effect on the audio player */ + .audio-player:hover { + background-color: #fcfbf9; + cursor: pointer; + } + \ No newline at end of file diff --git a/app/static/distract.js b/app/static/distract.js new file mode 100644 index 0000000000000000000000000000000000000000..73e81401b0968762a915410f26197a34bfdfd404 --- /dev/null +++ b/app/static/distract.js @@ -0,0 +1,165 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Happy", + artist: "Pharrell Williams", + image: "/static/happy.jpeg", + path: "/static/Pharrell Williams - Happy (Video).mp3" + }, + { + name: "CAN'T STOP THE FEELING! ", + artist: "DreamWorks", + image: "/static/couldntstopfeel.jpeg", + path: "/static/CAN'T STOP THE FEELING! (from DreamWorks Animation's TROLLS) (Official Video).mp3" + }, + { + name: "I'm Still Standing", + artist: "Elton John", + image: "/static/imstillstanding.jpeg", + path: "/static/Elton John - I'm Still Standing.mp3", + }, + { + name: "Starboy", + artist: "Weeknd", + image: "/static/weeknd.png", + path: "/static/The Weeknd - Starboy ft.mp3", + }, + { + name: "All Star", + artist: "Smash Mouth", + image: "/static/allstarsmash.jpeg", + path: "/static/Smash Mouth - All Star (Official Music Video).mp3", + } + +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/static/distractandchange.css b/app/static/distractandchange.css new file mode 100644 index 0000000000000000000000000000000000000000..e71116be44a2b373a17f562a81b8dce6c5ca64d9 --- /dev/null +++ b/app/static/distractandchange.css @@ -0,0 +1,29 @@ +/* style.css */ +.audio-player { + background-color: var(--secondary-color); + background-image: url("path/to/subtle-pattern.png"); /* Optional */ + border-radius: 15px; + padding: 30px; + box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.15); +} + +.player-controls { + display: flex; + justify-content: center; + width: 100%; + margin-bottom: 15px; +} + +.player-controls button { + /* Style your buttons */ +} + +.song-info { + text-align: center; +} + +.album-cover { + width: 150px; + height: 150px; + margin-bottom: 10px; +} diff --git a/app/static/energy.js b/app/static/energy.js new file mode 100644 index 0000000000000000000000000000000000000000..7d509c77bab02567614a2baa79e2b0978962209e --- /dev/null +++ b/app/static/energy.js @@ -0,0 +1,163 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Stronger", + artist: "Kanye West", + image: "stronger.jpeg", + path: "Kanye West - Stronger.mp3" + }, + { + name: "Chak De India", + artist: "Salim-Sulaiman", + image: "chakdeindia.jpeg", + path: "Chak De India Song Title Song Shah Rukh Khan Sukhwinder Singh Salim-Sulaiman Jaideep Sahni.mp3 }, + { + name: "Dhaakad", + artist: "Pritam", + image: "dangal.jpeg", + path: "Dhaakad - Full Video Dangal Aamir Khan Pritam Amitabh Bhattacharya Raftaar.mp3 }, + { + name: "Roar", + artist: "Katy Perry", + image: "/static/roar.jpeg", + path: "/static/Katy Perry - Roar.mp3", + }, + + { + name: "Uptown Funk", + artist: "Mark Ronson", + image: "/static/uptownfunk.jpeg", + path: "/static/Mark Ronson - Uptown Funk (Official Video) ft. Bruno Mars.mp3" + }, +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/static/engage.js b/app/static/engage.js new file mode 100644 index 0000000000000000000000000000000000000000..749ce1efb6cded6d5a9cb7f58bbe614aa8cfdbb2 --- /dev/null +++ b/app/static/engage.js @@ -0,0 +1,165 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Smells Like Teen Spirit ", + artist: "Nirvana", + image: "/static/smellsliketeen.jpeg", + path: "/static/Nirvana - Smells Like Teen Spirit (Official Music Video).mp3", + }, + { + name: "lifeonmars", + artist: "David Bowie", + image: "/static/lifeonmars.jpeg", + path: "/static/David Bowie Life On Mars_ (Official Video).mp3" + }, + { + name: "Queen", + artist: "Bohemian Rhapsody", + image: "/static/queen.jpeg", + path: "/static/Queen Bohemian Rhapsody (Official Video Remastered).mp3" + }, + { + name: "Hotel California", + artist: "Remaster", + image: "/static/hotelcalifornia.jpeg", + path: "/static/Hotel California (2013 Remaster).mp3", + }, + { + name: "Hallelujah", + artist: "Leonard Cohen", + image: "/static/hallelujah.jpeg", + path: "/static/Leonard Cohen - Hallelujah (Live In London).mp3", + } + +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/static/footer.js b/app/static/footer.js new file mode 100644 index 0000000000000000000000000000000000000000..3b31be0bfe052e0b0d9f4322844f583f278434e0 --- /dev/null +++ b/app/static/footer.js @@ -0,0 +1,8 @@ +function myFunction() { + var x = document.getElementById("myFootnav"); + if (x.className === "footnov") { + x.className += " responsive"; + } else { + x.className = "footnov"; + } + } \ No newline at end of file diff --git a/app/static/footer_file.css b/app/static/footer_file.css new file mode 100644 index 0000000000000000000000000000000000000000..2b97fad5348fd5c2bb3bdadb5681b305b4368770 --- /dev/null +++ b/app/static/footer_file.css @@ -0,0 +1,48 @@ +.footnov { + overflow: hidden; + background-color: #333; /* Darker gray for better contrast */ + color: #f2f2f2; + padding: 20px 0; /* Added padding for content */ +} + +.footnov a { + float: left; + display: block; + color: #f2f2f2; + text-align: center; + padding: 16px 20px; + text-decoration: none; + font-size: 17px; + transition: background-color 0.3s ease; /* Adding transition */ +} + +.footnov a:hover { + background-color: #555; /* Slightly darker hover effect */ +} + +.footnov a.active { + background-color: rgb(80, 61, 226); /* Match header for consistency */ + color: white; +} + +@media screen and (max-width: 600px) { + .footnov a:not(:first-child) {display: none;} + .footnov a.icon { + float: right; + display: block; + } +} + +@media screen and (max-width: 100px) { + .footnov.responsive {position: relative;} + .footnov.responsive .icon { + position: absolute; + right: 0; + top: 0; + } + .footnov.responsive a { + float: none; + display: block; + text-align: left; + } +} diff --git a/app/static/header.js b/app/static/header.js new file mode 100644 index 0000000000000000000000000000000000000000..4f4af6310277c45bc610ae41514f78722b3f1ed2 --- /dev/null +++ b/app/static/header.js @@ -0,0 +1,8 @@ +function myFunction() { + var x = document.getElementById("mytopnav"); + if (x.className === "topnav") { + x.className += " responsive"; + } else { + x.className = "topnav"; + } + } \ No newline at end of file diff --git a/app/static/header_file.css b/app/static/header_file.css new file mode 100644 index 0000000000000000000000000000000000000000..360c4a4beb374a082b4e1e34c6c0aa7bc33817b8 --- /dev/null +++ b/app/static/header_file.css @@ -0,0 +1,77 @@ +body { + margin: 0; + text-align: left; + font-family: 'Roboto', sans-serif; /* More modern font choice */ +} + +.topnav { + overflow: hidden; + background-color: #007bff; +} + +.topnav a { + float: left; + display: block; + color: white; + text-align: center; + padding: 16px 20px; /* Increased padding for a more spacious look */ + text-decoration: none; + font-size: 17px; + margin-right: 15px; + transition: background-color 0.3s ease; /* Adding transition */ +} + +.topnav a:hover { + background-color: black; /* Black with low opacity */ + color: white; /* Cleaner contrast */ +} + +.topnav a.active { + color: white; +} + +/* Responsive Design */ +@media screen and (max-width: 600px) { + .topnav a:not(:first-child) { display: none; } + .topnav a.icon { + float: right; + display: block; + font-size: 24px; /* Larger icon for better visibility */ + } +} + +@media screen and (max-width: 600px) { + .topnav.responsive { position: relative; } + .topnav.responsive .icon { + position: absolute; + right: 0; + top: 0; + } + .topnav.responsive a { + float: none; + display: block; + text-align: left; + } +} + + + .alert { + padding: 20px; + background-color: #f44336; + color: black; + } + + .closebtn { + margin-left: 15px; + color: white; + font-weight: bold; + float: right; + font-size: 22px; + line-height: 20px; + cursor: pointer; + transition: 0.3s; + } + + .closebtn:hover { + color: black; + } diff --git a/app/static/login.css b/app/static/login.css new file mode 100644 index 0000000000000000000000000000000000000000..d9058cf23b53af886b30ed5b84a0ea9c02ca5ebc --- /dev/null +++ b/app/static/login.css @@ -0,0 +1,39 @@ +/* login.css and register.css (adjust as needed) */ +.container { + width: 400px; + margin: 50px auto; + padding: 20px; + border: 1px solid #ddd; + border-radius: 8px; + text-align: center; + background-color: #f8f8f8; + box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); +} + +h1 { + margin-bottom: 20px; + color: #333; +} + +input[type="text"], input[type="email"], input[type="password"] { + width: 100%; + padding: 10px; + margin-bottom: 15px; + border: 1px solid #ccc; + border-radius: 4px; +} + +.button-primary { /* Reuse from previous example */ + background-color: #007bff; + color: white; + border: none; + padding: 10px 20px; + text-decoration: none; + border-radius: 5px; + font-size: 1rem; + transition: background-color 0.3s ease; +} + +.button-primary:hover { + background-color: #0056b3; +} diff --git a/app/static/main.css b/app/static/main.css new file mode 100644 index 0000000000000000000000000000000000000000..d80b150134cdc262b2b18a3b6f0a628fbe90a014 --- /dev/null +++ b/app/static/main.css @@ -0,0 +1,109 @@ +/* Add a gradient background color to the body */ +body { + background: linear-gradient(to right, #0f4da6, #0f4da6, #1e272e, #1e272e); +} + +/* Center the content */ +.container { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + min-height: 100vh; +} + +/* Style the header */ +header { + background-color: #007bff; + color: white; + padding: 1rem; + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 100; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +h1.title-font { + font-family: 'Dancing Script', cursive; + font-weight: 400; + margin-bottom: 0.5rem; + color: white; /* Change the color to your desired color */ + font-size: 2.5rem; /* Increase the font size */ + animation: fadeIn 2s forwards; /* Apply animation */ +} + +p { + font-family: 'Dancing Script', cursive; + font-weight: 400; + margin-bottom: 0.5rem; + color: black; /* Change the color to your desired color */ + font-size: 1.5rem; /* Increase the font size */ + animation: fadeIn 2s forwards; /* Apply animation */ + transition: color 0.5s ease-in-out; /* Apply transition */ + +} + +@keyframes typing { + from { width: 0; } + to { width: 100%; } +} + +@keyframes blink-caret { + from, to { border-color: transparent; } + 50% { border-color: #ff00ff; } /* Change the color to your desired color */ +} + + +p.title { + font-size: 2.5rem; + font-weight: bold; + text-transform: uppercase; + letter-spacing: 2px; + color: white; + margin-bottom: 2rem; + text-align: center; + animation: fadeIn 2s forwards; + transition: color 0.5s ease-in-out; +} + +/* Animation for fading in */ +@keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +/* Style the button */ +.button-primary { + background-color: white; + color: black; + border: none; + padding: 10px 20px; + text-decoration: none; + border-radius: 5px; + font-size: 1rem; + transition: background-color 0.3s ease; + margin-top: 2rem; + animation: pulse 1s ease-in-out infinite; + +} + +.button-primary:hover { + background-color: #f0f0f0; +} +@keyframes pulse { + 0% { + box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.5); + } + 50% { + box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.5); + } + 100% { + box-shadow: 0 0 0 0px rgba(0, 0, 0, 0.5); + } +} diff --git a/app/static/main.js b/app/static/main.js new file mode 100644 index 0000000000000000000000000000000000000000..8f1ef56a0c7ab3018ba334f4f88d5a5ca7c5bd80 --- /dev/null +++ b/app/static/main.js @@ -0,0 +1,202 @@ +/* Copyright 2013 Chris Wilson + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +window.AudioContext = window.AudioContext || window.webkitAudioContext; + +var audioContext = new AudioContext(); +var audioInput = null, + realAudioInput = null, + inputPoint = null, + audioRecorder = null; +var rafID = null; +var analyserContext = null; +var canvasWidth, canvasHeight; +var recIndex = 0; + + +function gotBuffers(buffers) { + audioRecorder.exportMonoWAV(doneEncoding); +} + +function doneEncoding(soundBlob) { + fetch('/audio', { + method: "POST", // Specify POST method + body: soundBlob + }) + .then(response => { + if (response.ok) { + return response.json(); // Parse JSON response + } else { + throw new Error("Error in Flask /audio route: " + response.status); + } + }) + .then(data => { + window.location.href = data.url; // Redirect using URL from the response + }) + .catch(error => { + console.error(error); + }); + } + + +function stopRecording() { + // stop recording + audioRecorder.stop(); + document.getElementById('stop').disabled = true; + document.getElementById('start').removeAttribute('disabled'); + audioRecorder.getBuffers(gotBuffers); +} + +function startRecording() { + + // start recording + if (!audioRecorder) + return; + document.getElementById('start').disabled = true; + document.getElementById('stop').removeAttribute('disabled'); + audioRecorder.clear(); + audioRecorder.record(); +} + +function convertToMono(input) { + var splitter = audioContext.createChannelSplitter(2); + var merger = audioContext.createChannelMerger(2); + + input.connect(splitter); + splitter.connect(merger, 0, 0); + splitter.connect(merger, 0, 1); + return merger; +} + +function cancelAnalyserUpdates() { + window.cancelAnimationFrame(rafID); + rafID = null; +} + +function updateAnalysers(time) { + if (!analyserContext) { + var canvas = document.getElementById("analyser"); + console.log("Canvas:", canvas); // Log 1 + if (canvas) { // Check canvas exists + canvasWidth = canvas.width; + canvasHeight = canvas.height; + analyserContext = canvas.getContext('2d'); + } else { + console.error("Canvas with ID 'analyser' not found!"); + } + } + + // analyzer draw code here + { + var SPACING = 3; + var BAR_WIDTH = 1; + var numBars = Math.round(canvasWidth / SPACING); + var freqByteData = new Uint8Array(analyserNode.frequencyBinCount); + + analyserNode.getByteFrequencyData(freqByteData); + + analyserContext.clearRect(0, 0, canvasWidth, canvasHeight); + analyserContext.fillStyle = '#F6D565'; + analyserContext.lineCap = 'round'; + var multiplier = analyserNode.frequencyBinCount / numBars; + + // Draw rectangle for each frequency bin. + for (var i = 0; i < numBars; ++i) { + var magnitude = 0; + var offset = Math.floor(i * multiplier); + // gotta sum/average the block, or we miss narrow-bandwidth spikes + for (var j = 0; j < multiplier; j++) + magnitude += freqByteData[offset + j]; + magnitude = magnitude / multiplier; + var magnitude2 = freqByteData[i * multiplier]; + analyserContext.fillStyle = "hsl( " + Math.round((i * 360) / numBars) + ", 100%, 50%)"; + analyserContext.fillRect(i * SPACING, canvasHeight, BAR_WIDTH, -magnitude); + } + } + + rafID = window.requestAnimationFrame(updateAnalysers); +} + +function toggleMono() { + if (audioInput != realAudioInput) { + audioInput.disconnect(); + realAudioInput.disconnect(); + audioInput = realAudioInput; + } else { + realAudioInput.disconnect(); + audioInput = convertToMono(realAudioInput); + } + + audioInput.connect(inputPoint); +} + +function gotStream(stream) { + document.getElementById('start').removeAttribute('disabled'); + + inputPoint = audioContext.createGain(); + + // Create an AudioNode from the stream. + realAudioInput = audioContext.createMediaStreamSource(stream); + audioInput = realAudioInput; + audioInput.connect(inputPoint); + +// audioInput = convertToMono( input ); + + analyserNode = audioContext.createAnalyser(); + analyserNode.fftSize = 2048; + inputPoint.connect(analyserNode); + + audioRecorder = new Recorder(inputPoint); + + zeroGain = audioContext.createGain(); + zeroGain.gain.value = 0.0; + inputPoint.connect(zeroGain); + zeroGain.connect(audioContext.destination); + updateAnalysers(); +} + +function initAudio() { + if (!navigator.getUserMedia) + navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia; + if (!navigator.cancelAnimationFrame) + navigator.cancelAnimationFrame = navigator.webkitCancelAnimationFrame || navigator.mozCancelAnimationFrame; + if (!navigator.requestAnimationFrame) + navigator.requestAnimationFrame = navigator.webkitRequestAnimationFrame || navigator.mozRequestAnimationFrame; + + navigator.getUserMedia( + { + "audio": { + "mandatory": { + "googEchoCancellation": "false", + "googAutoGainControl": "false", + "googNoiseSuppression": "false", + "googHighpassFilter": "false" + }, + "optional": [] + }, + }, gotStream, function (e) { + alert('Error getting audio'); + console.log(e); + }); +} + +window.addEventListener('load', initAudio); + +function unpause() { + document.getElementById('init').style.display = 'none'; + audioContext.resume().then(() => { + console.log('Playback resumed successfully'); + }); +} diff --git a/app/static/recorder.js b/app/static/recorder.js new file mode 100644 index 0000000000000000000000000000000000000000..cb73144da5f7b5c2776f7b96a5cd6979b0db9b50 --- /dev/null +++ b/app/static/recorder.js @@ -0,0 +1,99 @@ +(function(window){ + + var WORKER_PATH = '/static/recorderWorker.js'; + + var Recorder = function(source, cfg){ + var config = cfg || {}; + var bufferLen = config.bufferLen || 4096; + this.context = source.context; + if(!this.context.createScriptProcessor){ + this.node = this.context.createJavaScriptNode(bufferLen, 2, 2); + } else { + this.node = this.context.createScriptProcessor(bufferLen, 2, 2); + } + + var worker = new Worker(config.workerPath || WORKER_PATH); + worker.postMessage({ + command: 'init', + config: { + sampleRate: this.context.sampleRate + } + }); + var recording = false, + currCallback; + + this.node.onaudioprocess = function(e){ + if (!recording) return; + worker.postMessage({ + command: 'record', + buffer: [ + e.inputBuffer.getChannelData(0), + e.inputBuffer.getChannelData(1) + ] + }); + } + + this.configure = function(cfg){ + for (var prop in cfg){ + if (cfg.hasOwnProperty(prop)){ + config[prop] = cfg[prop]; + } + } + } + + this.record = function(){ + recording = true; + } + + this.stop = function(){ + recording = false; + } + + this.clear = function(){ + worker.postMessage({ command: 'clear' }); + } + + this.getBuffers = function(cb) { + currCallback = cb || config.callback; + worker.postMessage({ command: 'getBuffers' }) + } + + this.exportWAV = function(cb, type){ + currCallback = cb || config.callback; + type = type || config.type || 'audio/wav'; + if (!currCallback) throw new Error('Callback not set'); + worker.postMessage({ + command: 'exportWAV', + type: type + }); + } + + this.exportMonoWAV = function(cb, type){ + currCallback = cb || config.callback; + type = type || config.type || 'audio/wav'; + if (!currCallback) throw new Error('Callback not set'); + worker.postMessage({ + command: 'exportMonoWAV', + type: type + }); + } + + worker.onmessage = function(e){ + var blob = e.data; + currCallback(blob); + } + + source.connect(this.node); + this.node.connect(this.context.destination); // if the script node is not connected to an output the "onaudioprocess" event is not triggered in chrome. + }; + + Recorder.setupDownload = function(blob, filename){ + var url = (window.URL || window.webkitURL).createObjectURL(blob); + var link = document.getElementById("save"); + link.href = url; + link.download = filename || 'output.wav'; + } + + window.Recorder = Recorder; + +})(window); diff --git a/app/static/recorderWorker.js b/app/static/recorderWorker.js new file mode 100644 index 0000000000000000000000000000000000000000..8b3d5f80a460b26acdbcb65b61fb4bf796c9a1bf --- /dev/null +++ b/app/static/recorderWorker.js @@ -0,0 +1,142 @@ +var recLength = 0, + recBuffersL = [], + recBuffersR = [], + sampleRate; + +this.onmessage = function(e){ + switch(e.data.command){ + case 'init': + init(e.data.config); + break; + case 'record': + record(e.data.buffer); + break; + case 'exportWAV': + exportWAV(e.data.type); + break; + case 'exportMonoWAV': + exportMonoWAV(e.data.type); + break; + case 'getBuffers': + getBuffers(); + break; + case 'clear': + clear(); + break; + } +}; + +function init(config){ + sampleRate = config.sampleRate; +} + +function record(inputBuffer){ + recBuffersL.push(inputBuffer[0]); + recBuffersR.push(inputBuffer[1]); + recLength += inputBuffer[0].length; +} + +function exportWAV(type){ + var bufferL = mergeBuffers(recBuffersL, recLength); + var bufferR = mergeBuffers(recBuffersR, recLength); + var interleaved = interleave(bufferL, bufferR); + var dataview = encodeWAV(interleaved); + var audioBlob = new Blob([dataview], { type: type }); + + this.postMessage(audioBlob); +} + +function exportMonoWAV(type){ + var bufferL = mergeBuffers(recBuffersL, recLength); + var dataview = encodeWAV(bufferL, true); + var audioBlob = new Blob([dataview], { type: type }); + + this.postMessage(audioBlob); +} + +function getBuffers() { + var buffers = []; + buffers.push( mergeBuffers(recBuffersL, recLength) ); + buffers.push( mergeBuffers(recBuffersR, recLength) ); + this.postMessage(buffers); +} + +function clear(){ + recLength = 0; + recBuffersL = []; + recBuffersR = []; +} + +function mergeBuffers(recBuffers, recLength){ + var result = new Float32Array(recLength); + var offset = 0; + for (var i = 0; i < recBuffers.length; i++){ + result.set(recBuffers[i], offset); + offset += recBuffers[i].length; + } + return result; +} + +function interleave(inputL, inputR){ + var length = inputL.length + inputR.length; + var result = new Float32Array(length); + + var index = 0, + inputIndex = 0; + + while (index < length){ + result[index++] = inputL[inputIndex]; + result[index++] = inputR[inputIndex]; + inputIndex++; + } + return result; +} + +function floatTo16BitPCM(output, offset, input){ + for (var i = 0; i < input.length; i++, offset+=2){ + var s = Math.max(-1, Math.min(1, input[i])); + output.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true); + } +} + +function writeString(view, offset, string){ + for (var i = 0; i < string.length; i++){ + view.setUint8(offset + i, string.charCodeAt(i)); + } +} + +function encodeWAV(samples, mono){ + var buffer = new ArrayBuffer(44 + samples.length * 2); + var view = new DataView(buffer); + + /* RIFF identifier */ + writeString(view, 0, 'RIFF'); + /* file length */ + view.setUint32(4, 32 + samples.length * 2, true); + /* RIFF type */ + writeString(view, 8, 'WAVE'); + /* format chunk identifier */ + writeString(view, 12, 'fmt '); + /* format chunk length */ + view.setUint32(16, 16, true); + /* sample format (raw) */ + view.setUint16(20, 1, true); + /* channel count */ + view.setUint16(22, mono?1:2, true); + /* sample rate */ + view.setUint32(24, sampleRate, true); + /* byte rate (sample rate * block align) */ + view.setUint32(28, sampleRate * 4, true); + /* block align (channel count * bytes per sample) */ + view.setUint16(32, 4, true); + /* bits per sample */ + view.setUint16(34, 16, true); + /* data chunk identifier */ + writeString(view, 36, 'data'); + /* data chunk length */ + view.setUint32(40, samples.length * 2, true); + + floatTo16BitPCM(view, 44, samples); + + return view; +} diff --git a/app/static/reflective.js b/app/static/reflective.js new file mode 100644 index 0000000000000000000000000000000000000000..52856be9b7ebfe80a784061b7b0d6d2f8cf1c6b9 --- /dev/null +++ b/app/static/reflective.js @@ -0,0 +1,164 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Skinny Love", + artist: "Bon Iver", + image: "/static/skinnylove.jpeg", + path: "/static/Bon Iver - Skinny Love (Later Archive).mp3" + }, + { + name: "Ae Dil Hai Mushkil", + artist: "ArijitPritam", + image: "/static/adhm.jpeg", + path: "/static/Ae Dil Hai Mushkil Title Track Full Video - Ranbir, Anushka, AishwaryaArijitPritam.mp3" + }, + { + name: "Fix You", + artist: "Coldplay", + image: "/static/fixyou.jpeg", + path: "/static/Coldplay - Fix You (Official Video).mp3", + }, + { + name: "Everybody Hurts", + artist: "R.E.M.", + image: "/static/everybodyhrts.jpeg", + path: "/static/R.E.M. - Everybody Hurts (Official Music Video).mp3", + }, + { + name: "The Sound of Silence", + artist: "Simon & Garfunkel", + image: "/static/soundofsilence.jpeg", + path: "/static/Simon & Garfunkel - The Sound of Silence (from The Concert in Central Park).mp3", + } +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/static/register.css b/app/static/register.css new file mode 100644 index 0000000000000000000000000000000000000000..d9058cf23b53af886b30ed5b84a0ea9c02ca5ebc --- /dev/null +++ b/app/static/register.css @@ -0,0 +1,39 @@ +/* login.css and register.css (adjust as needed) */ +.container { + width: 400px; + margin: 50px auto; + padding: 20px; + border: 1px solid #ddd; + border-radius: 8px; + text-align: center; + background-color: #f8f8f8; + box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); +} + +h1 { + margin-bottom: 20px; + color: #333; +} + +input[type="text"], input[type="email"], input[type="password"] { + width: 100%; + padding: 10px; + margin-bottom: 15px; + border: 1px solid #ccc; + border-radius: 4px; +} + +.button-primary { /* Reuse from previous example */ + background-color: #007bff; + color: white; + border: none; + padding: 10px 20px; + text-decoration: none; + border-radius: 5px; + font-size: 1rem; + transition: background-color 0.3s ease; +} + +.button-primary:hover { + background-color: #0056b3; +} diff --git a/app/static/soothie.js b/app/static/soothie.js new file mode 100644 index 0000000000000000000000000000000000000000..cb46446322d32a1b9e6e02285fa7958d3fcfdae3 --- /dev/null +++ b/app/static/soothie.js @@ -0,0 +1,165 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Lean On Me", + artist: "Bill Withers", + image: "/static/leanonme.jpeg", + path: "/static/Lean on Me.mp3" + }, + { + name: "Walkin on sunshine", + artist: "Katrina and the Waves", + image: "/static/walkinonsunshine.jpeg", + path: "/static/Katrina & The Waves - Walking On Sunshine (Official Music Video).mp3" + }, + { + name: "Kal Ho Naa Ho", + artist: "Sonu Nigam Karan J", + image: "/static/kalhonaho.jpeg", + path: "/static/Kal Ho Naa Ho Full Video - Title TrackShah Rukh Khan,Saif Ali,PreitySonu NigamKaran J.mp3, + }, + { + name: "Moh Moh Ke Dhaage", + artist: "Anu Malik, Varun", + image: "/static/mohmohkedage.jpeg", + path: "/static/Moh Moh Ke Dhaage Lyrical Song Dum Laga Ke Haisha Ayushmann, Bhumi Monali Anu Malik, Varun.mp3", + }, + { + name: "You've Got A Friend", + artist: "James Taylor", + image: "/static/yougotafriend.jpeg", + path: "/static/James Taylor - You've Got A Friend (Official Audio).mp3", + }, + +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/static/style.css b/app/static/style.css new file mode 100644 index 0000000000000000000000000000000000000000..876385d33fc957f15dd50f863fde9a584270ae3e --- /dev/null +++ b/app/static/style.css @@ -0,0 +1,194 @@ +body { + background-color: lightgreen; + /* Smoothly transition the background color */ + transition: background-color .5s; +} + +.content { + display: flex; +} + +.left-content { + flex: 1; + padding: 20px; + font-size: 1.5em; + font-weight: bold; +} +.perfect-size { + width: 200px; + height: 40px; +} + +.typing-effect-1 { + animation: typing-1 3s steps(40, end) forwards; +} + +.typing-effect-2 { + animation: typing-2 4s steps(40, end) forwards; +} + +.typing-effect-1, .typing-effect-2 { + white-space: nowrap; + overflow: hidden; + border-right: 2px solid; +} + +@keyframes typing-1 { + 0% { width: 0; } + 99.9% { width: 100%; } + 100% { width: 100%; border-right: none; } +} + +@keyframes typing-2 { + 0% { width: 0; } + 99.9% { width: 100%; } + 100% { width: 100%; border-right: none; } +} +.right-content { + flex: 1; + display: flex; + flex-direction: column; /* Stack elements vertically */ + align-items: flex-start; /* Align content to top left */ + /* Remove center alignment */ +} +.typing-animation { + overflow: hidden; + white-space: nowrap; + animation: typing 3.5s steps(40, end) forwards; +} + +.middle-content { + flex: 1; + /* Removed most styles, they are redundant with right-content */ + margin-top: 5vh; /* Adjusted margin from top */ +} + +.player { + height: 80vh; + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; +} + +.details { + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + margin-top: 25px; +} + +.track-art { + margin: 25px; + height: 250px; + width: 250px; + background-image: url("https://images.pexels.com/photos/262034/pexels-photo-262034.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260"); + background-size: cover; + border-radius: 15%; +} + +.now-playing { + font-size: 1rem; +} + +.track-name { + overflow: hidden; + border-right: 2px solid; + animation: typing 3.5s steps(40, end) forwards; + + font-size: 1.5rem; + +} +.track-artist{ + white-space: nowrap; + overflow: hidden; + border-right: 2px solid; + animation: typing 3.5s steps(40, end) forwards; + font-size: 3rem; + +} +@keyframes typing { + 0% { width: 0; } + 99.9% { width: 100%; } + 100% { width: 100%; border-right: none; } +} +.buttons { + display: flex; + flex-direction: row; + align-items: center; +} + +.playpause-track, .prev-track, .next-track { + padding: 25px; + opacity: 0.8; + + /* Smoothly transition the opacity */ + transition: opacity .2s; +} + +.playpause-track:hover, .prev-track:hover, .next-track:hover { + opacity: 1.0; +} + +.slider_container { + width: 75%; + max-width: 400px; + display: flex; + justify-content: center; + align-items: center; +} + +/* Modify the appearance of the slider */ +.seek_slider, .volume_slider { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + height: 5px; + background: black; + opacity: 0.7; + -webkit-transition: .2s; + transition: opacity .2s; +} + +/* Modify the appearance of the slider thumb */ +.seek_slider::-webkit-slider-thumb, .volume_slider::-webkit-slider-thumb { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + width: 15px; + height: 15px; + background: white; + cursor: pointer; + border-radius: 50%; +} + +.seek_slider:hover, .volume_slider:hover { + opacity: 1.0; +} + +.seek_slider { + width: 60%; +} + +.volume_slider { + width: 30%; +} + +.current-time, .total-duration { + padding: 10px; +} + +i.fa-volume-down, i.fa-volume-up { + padding: 10px; +} + +i.fa-play-circle, i.fa-pause-circle, i.fa-step-forward, i.fa-step-backward { + cursor: pointer; +} + +.predicted-info { + margin-top: 1em; /* Adjust margin for spacing */ + text-align: left; /* Align text to the left */ +} + diff --git a/app/templates/audio_to_text.html b/app/templates/audio_to_text.html new file mode 100644 index 0000000000000000000000000000000000000000..5316d07ba80814dff0c9f5a124be67857972445d --- /dev/null +++ b/app/templates/audio_to_text.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + {% include "header.html" %} + +
+
+

Mood Based Music Recommendation System

+ + + +
+
+

Record Audio

+ + +

Press Start to start recording audio and press Stop to end recording audio

+
+
+
+
+ + + + + + diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000000000000000000000000000000000000..db1f29bf242971a90d4b1d40dc567a9fd1ed31bd --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,27 @@ + + + + + + Music Zone! + + + +
+

Music for Your Mood!

+
+ +
+
+ **Transcription:** +
+ + + {% block category_content %} + {% endblock %} +
+ + + + + diff --git a/app/templates/basic.html b/app/templates/basic.html new file mode 100644 index 0000000000000000000000000000000000000000..54cc1124ea51c0f95eec52e7a5ecd6ef32ae7ea1 --- /dev/null +++ b/app/templates/basic.html @@ -0,0 +1,11 @@ + + + + + Basic Template + + +

Hello from a basic template!

+ + + diff --git a/app/templates/dem.css b/app/templates/dem.css new file mode 100644 index 0000000000000000000000000000000000000000..ce49f694d7a8909c8fcc4a2680ae35218a84f854 --- /dev/null +++ b/app/templates/dem.css @@ -0,0 +1,52 @@ +*{ + font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; + color: #171717; + background-color: antiquewhite; +} +header { + text-align: center; + +} +.grid-container { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 20px; +} + +.card { + border: 3px solid #f6a503; + border-radius: 8px; + overflow: hidden; +} + +.card img { + width: 100%; + height: 600px; + display: block; +} + +.card-content { + padding: 20px; +} + +.card-content h2 { + margin-top: 0; +} + +.card-content h4 { + margin-bottom: 10px; +} + +.card-content button { + background-color: #f6a503; + color: #000000; + border: none; + padding: 10px 20px; + border-radius: 5px; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.card-content button:hover { + background-color: #ffffff; +} diff --git a/app/templates/distractandchange.html b/app/templates/distractandchange.html new file mode 100644 index 0000000000000000000000000000000000000000..322c2f1ac98e482dac196999531f007f556a4d3c --- /dev/null +++ b/app/templates/distractandchange.html @@ -0,0 +1,55 @@ + + + + + + Simple Music Player + + + + + + + +
+
+

+

Predicted Text: {{ text }}

+

Predicted Emotion: {{ emotion }}

+
+
+
+
+
+
PLAYING x OF y
+
+
Track Name
+
Track Artist
+
+
+
+
+
+
+
+
00:00
+ +
00:00
+
+
+ + + +
+
+
+
+

{{ emotionInfo.heading }}

+

{{ emotionInfo.info }}

+
+
+ + + + + diff --git a/app/templates/energeticandmotivate.html b/app/templates/energeticandmotivate.html new file mode 100644 index 0000000000000000000000000000000000000000..ebf21f235bf16c483bb0c709708d089655fc07d0 --- /dev/null +++ b/app/templates/energeticandmotivate.html @@ -0,0 +1,55 @@ + + + + + + Simple Music Player + + + + + + + +
+
+

+

Predicted Text: {{ text }}

+

Predicted Emotion: {{ emotion }}

+
+
+
+
+
+
PLAYING x OF y
+
+
Track Name
+
Track Artist
+
+
+
+
+
+
+
+
00:00
+ +
00:00
+
+
+ + + +
+
+
+
+

{{ emotionInfo.heading }}

+

{{ emotionInfo.info }}

+
+
+ + + + + diff --git a/app/templates/energy b/app/templates/energy new file mode 100644 index 0000000000000000000000000000000000000000..c7e051303e6c0573eee9e998274a12ee514e8112 --- /dev/null +++ b/app/templates/energy @@ -0,0 +1,159 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "energy", + artist: "Broke For Free", + image: "https://images.pexels.com/photos/2264753/pexels-photo-2264753.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Broke_For_Free/Directionless_EP/Broke_For_Free_-_01_-_Night_Owl.mp3" + }, + { + name: "Enthusiast", + artist: "Tours", + image: "https://images.pexels.com/photos/3100835/pexels-photo-3100835.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/no_curator/Tours/Enthusiast/Tours_-_01_-_Enthusiast.mp3" + }, + { + name: "Shipping Lanes", + artist: "Chad Crouch", + image: "https://images.pexels.com/photos/1717969/pexels-photo-1717969.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/ccCommunity/Chad_Crouch/Arps/Chad_Crouch_-_Shipping_Lanes.mp3", + }, + { + name: "Starboy", + artist: "Weeknd", + image: "/static/weeknd.jpeg", + path: "/static/The Weeknd - Starboy ft.mp3", + }, + +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) { + track_index += 1; + } else { + track_index = 0; + } + + loadTrack(track_index); // Load the new track + + // Once the track is loaded, call playTrack + curr_track.addEventListener('loadeddata', playTrack); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/templates/engageandexplore.html b/app/templates/engageandexplore.html new file mode 100644 index 0000000000000000000000000000000000000000..19f0ec9ece99f354bb60fbe8327968f1770dd10f --- /dev/null +++ b/app/templates/engageandexplore.html @@ -0,0 +1,55 @@ + + + + + + Simple Music Player + + + + + + + +
+
+

+

Predicted Text: {{ text }}

+

Predicted Emotion: {{ emotion }}

+
+
+
+
+
+
PLAYING x OF y
+
+
Track Name
+
Track Artist
+
+
+
+
+
+
+
+
00:00
+ +
00:00
+
+
+ + + +
+
+
+
+

{{ emotionInfo.heading }}

+

{{ emotionInfo.info }}

+
+
+ + + + + diff --git a/app/templates/footer.html b/app/templates/footer.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/templates/header.html b/app/templates/header.html new file mode 100644 index 0000000000000000000000000000000000000000..c9f6711d70a33afa2f7452c51458fa3d1869c05c --- /dev/null +++ b/app/templates/header.html @@ -0,0 +1,19 @@ + +
+ Home + Speech to Text +
+ + + +{% with messages = get_flashed_messages(with_categories=true) %} +{% if messages %} + {% for category,message in messages %} + +
+ × + {{category}} : {{ message }} +
+ {% endfor %} +{% endif %} +{% endwith %} diff --git a/app/templates/index.html b/app/templates/index.html new file mode 100644 index 0000000000000000000000000000000000000000..c4dd6e849d25e9b0e5a1f313bfcf3d77dd6792bd --- /dev/null +++ b/app/templates/index.html @@ -0,0 +1,37 @@ + + + + + + + + + + + My Website + + +
+ +
+
+
+
+
+

Welcome to My Website

+

+ "The power of words can inspire, uplift, and transform."

+
+ +
+
+
+
+
+ + + diff --git a/app/templates/main.js b/app/templates/main.js new file mode 100644 index 0000000000000000000000000000000000000000..97824677ce176bfcc1fb6e57b5a66401bff09339 --- /dev/null +++ b/app/templates/main.js @@ -0,0 +1,155 @@ +let now_playing = document.querySelector(".now-playing"); +let track_art = document.querySelector(".track-art"); +let track_name = document.querySelector(".track-name"); +let track_artist = document.querySelector(".track-artist"); + +let playpause_btn = document.querySelector(".playpause-track"); +let next_btn = document.querySelector(".next-track"); +let prev_btn = document.querySelector(".prev-track"); + +let seek_slider = document.querySelector(".seek_slider"); +let volume_slider = document.querySelector(".volume_slider"); +let curr_time = document.querySelector(".current-time"); +let total_duration = document.querySelector(".total-duration"); + +let track_index = 0; +let isPlaying = false; +let updateTimer; + +// Create new audio element +let curr_track = document.createElement('audio'); + +// Define the tracks that have to be played +let track_list = [ + { + name: "Night Owl", + artist: "Broke For Free", + image: "https://images.pexels.com/photos/2264753/pexels-photo-2264753.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Broke_For_Free/Directionless_EP/Broke_For_Free_-_01_-_Night_Owl.mp3" + }, + { + name: "Enthusiast", + artist: "Tours", + image: "https://images.pexels.com/photos/3100835/pexels-photo-3100835.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/no_curator/Tours/Enthusiast/Tours_-_01_-_Enthusiast.mp3" + }, + { + name: "Shipping Lanes", + artist: "Chad Crouch", + image: "https://images.pexels.com/photos/1717969/pexels-photo-1717969.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=250&w=250", + path: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/ccCommunity/Chad_Crouch/Arps/Chad_Crouch_-_Shipping_Lanes.mp3", + }, + { + name: "Starboy", + artist: "Weeknd", + image: "D:\js-music-player-master-20240418T020306Z-001\js-music-player-master\weeknd.jpeg", + path: "D:\js-music-player-master-20240418T020306Z-001\js-music-player-master\The Weeknd - Starboy ft.mp3", + }, + +]; + +function random_bg_color() { + + // Get a number between 64 to 256 (for getting lighter colors) + let red = Math.floor(Math.random() * 256) + 64; + let green = Math.floor(Math.random() * 256) + 64; + let blue = Math.floor(Math.random() * 256) + 64; + + // Construct a color withe the given values + let bgColor = "rgb(" + red + "," + green + "," + blue + ")"; + + // Set the background to that color + document.body.style.background = bgColor; +} + +function loadTrack(track_index) { + clearInterval(updateTimer); + resetValues(); + curr_track.src = track_list[track_index].path; + curr_track.load(); + + track_art.style.backgroundImage = "url(" + track_list[track_index].image + ")"; + track_name.textContent = track_list[track_index].name; + track_artist.textContent = track_list[track_index].artist; + now_playing.textContent = "PLAYING " + (track_index + 1) + " OF " + track_list.length; + + updateTimer = setInterval(seekUpdate, 1000); + curr_track.addEventListener("ended", nextTrack); + random_bg_color(); +} + +function resetValues() { + curr_time.textContent = "00:00"; + total_duration.textContent = "00:00"; + seek_slider.value = 0; +} + +// Load the first track in the tracklist +loadTrack(track_index); + +function playpauseTrack() { + if (!isPlaying) playTrack(); + else pauseTrack(); +} + +function playTrack() { + curr_track.play(); + isPlaying = true; + playpause_btn.innerHTML = ''; +} + +function pauseTrack() { + curr_track.pause(); + isPlaying = false; + playpause_btn.innerHTML = '';; +} + +function nextTrack() { + if (track_index < track_list.length - 1) + track_index += 1; + else track_index = 0; + loadTrack(track_index); + playTrack(); +} + +function prevTrack() { + if (track_index > 0) + track_index -= 1; + else track_index = track_list.length; + loadTrack(track_index); + playTrack(); +} + +function seekTo() { + let seekto = curr_track.duration * (seek_slider.value / 100); + curr_track.currentTime = seekto; +} + +function setVolume() { + curr_track.volume = volume_slider.value / 100; +} + +function seekUpdate() { + let seekPosition = 0; + + if (!isNaN(curr_track.duration)) { + seekPosition = curr_track.currentTime * (100 / curr_track.duration); + + seek_slider.value = seekPosition; + + let currentMinutes = Math.floor(curr_track.currentTime / 60); + let currentSeconds = Math.floor(curr_track.currentTime - currentMinutes * 60); + let durationMinutes = Math.floor(curr_track.duration / 60); + let durationSeconds = Math.floor(curr_track.duration - durationMinutes * 60); + + if (currentSeconds < 10) { currentSeconds = "0" + currentSeconds; } + if (durationSeconds < 10) { durationSeconds = "0" + durationSeconds; } + if (currentMinutes < 10) { currentMinutes = "0" + currentMinutes; } + if (durationMinutes < 10) { durationMinutes = "0" + durationMinutes; } + + curr_time.textContent = currentMinutes + ":" + currentSeconds; + total_duration.textContent = durationMinutes + ":" + durationSeconds; + } +} + + diff --git a/app/templates/reflectiveandunderstand.html b/app/templates/reflectiveandunderstand.html new file mode 100644 index 0000000000000000000000000000000000000000..7b0d7d148ec25d31311365e0b84686ef1ed02f5f --- /dev/null +++ b/app/templates/reflectiveandunderstand.html @@ -0,0 +1,55 @@ + + + + + + Simple Music Player + + + + + + + +
+
+

+

Predicted Text: {{ text }}

+

Predicted Emotion: {{ emotion }}

+
+
+
+
+
+
PLAYING x OF y
+
+
Track Name
+
Track Artist
+
+
+
+
+
+
+
+
00:00
+ +
00:00
+
+
+ + + +
+
+
+
+

{{ emotionInfo.heading }}

+

{{ emotionInfo.info }}

+
+
+ + + + + diff --git a/app/templates/soothieanduplift.html b/app/templates/soothieanduplift.html new file mode 100644 index 0000000000000000000000000000000000000000..f83d52e505f06cdfc82d213aa91ad47f1913f11d --- /dev/null +++ b/app/templates/soothieanduplift.html @@ -0,0 +1,55 @@ + + + + + + Simple Music Player + + + + + + + +
+
+

+

Predicted Text: {{ text }}

+

Predicted Emotion: {{ emotion }}

+
+
+
+
+
+
PLAYING x OF y
+
+
Track Name
+
Track Artist
+
+
+
+
+
+
+
+
00:00
+ +
00:00
+
+
+ + + +
+
+
+
+

{{ emotionInfo.heading }}

+

{{ emotionInfo.info }}

+
+
+ + + + + diff --git a/app/templates/styles.css b/app/templates/styles.css new file mode 100644 index 0000000000000000000000000000000000000000..d7508a01ab95fc2f5d314459648465c08ef0f9b4 --- /dev/null +++ b/app/templates/styles.css @@ -0,0 +1,123 @@ +/* Reset some default styles */ +body, h1, h2, p, figure, audio { + margin: 0; + padding: 0; +} + +body { + font-family: Arial, sans-serif; + line-height: 1.6; + background-color: #f5f5f5; + color: #333; +} + +.header { + background-color: #ff9900; + color: #fff; + padding: 20px; + text-align: center; +} + +.song-box { + display: flex; + align-items: center; + justify-content: center; + padding: 20px; + background-color: #fff; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + margin-bottom: 20px; +} + +.song-info { + display: flex; + align-items: center; + margin-right: 20px; +} + +.song-cover { + width: 100px; + height: 100px; + object-fit: cover; + margin-right: 20px; +} + +.song-details { + display: flex; + flex-direction: column; +} + +.song-title { + font-weight: bold; + margin-bottom: 5px; +} + +.song-artist { + font-size: 14px; + color: #888; +} + +footer { + background-color: #333; + color: #fff; + padding: 10px; + text-align: center; +} +.audio-player { + display: flex; + align-items: center; + margin-bottom: 10px; /* Add a little space below the player */ +} + +.progress-container { + width: 250px; /* Adjust width as needed */ + height: 5px; + background-color: #333; + border-radius: 5px; + cursor: pointer; + margin-bottom: 5px; /* Small margin below the bar */ +} + +.progress { + height: 100%; + background-color: #1ed760; /* Spotify green */ + border-radius: 5px; + width: 0%; /* Start with 0% progress */ + transition: width 0.2s ease-out; +} + +.time { + margin-left: 10px; + color: #ccc; /* Light font color */ + font-size: 14px; +} +.time { + margin-left: 10px; + color: #ccc; /* Light font color */ + font-size: 14px; +} +.player-controls-wrapper { + display: flex; /* Keeps buttons in a row */ + justify-content: center; /* Centers them horizontally */ + margin-bottom: 15px; /* Spacing below buttons */ +} + +.player-btn { + background-color: #333; /* Dark background */ + border: none; + color: #fff; /* White text */ + border-radius: 50%; /* Circular */ + cursor: pointer; + font-size: 18px; + width: 35px; + height: 35px; + margin: 0 5px; /* Spacing between buttons */ + transition: background-color 0.3s ease; /* For hover effect */ +} + +.player-btn.play-pause { + font-size: 20px; /* Slightly bigger play/pause icon */ +} + +.player-btn:hover { + background-color: #555; /* Slightly darker on hover */ +} diff --git a/app/templates/weeknd.jpeg b/app/templates/weeknd.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..cfd745649b8b8efa7457068dea8d2bcbb33275f8 Binary files /dev/null and b/app/templates/weeknd.jpeg differ diff --git a/app/tmp/19b39466-5643-4804-a2fd-d72cfb24308b.wav b/app/tmp/19b39466-5643-4804-a2fd-d72cfb24308b.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/19b39466-5643-4804-a2fd-d72cfb24308b.wav differ diff --git a/app/tmp/265325fb-a7fd-4424-a3f7-a575a780f8e3.wav b/app/tmp/265325fb-a7fd-4424-a3f7-a575a780f8e3.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/265325fb-a7fd-4424-a3f7-a575a780f8e3.wav differ diff --git a/app/tmp/34e12c2e-e085-4b21-b2da-d68cde5664d9.wav b/app/tmp/34e12c2e-e085-4b21-b2da-d68cde5664d9.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/34e12c2e-e085-4b21-b2da-d68cde5664d9.wav differ diff --git a/app/tmp/429e4bcd-8b74-4baf-bc2c-82eb6491e270.wav b/app/tmp/429e4bcd-8b74-4baf-bc2c-82eb6491e270.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/429e4bcd-8b74-4baf-bc2c-82eb6491e270.wav differ diff --git a/app/tmp/476af51f-66ed-469d-b4e9-931f13edd0f2.wav b/app/tmp/476af51f-66ed-469d-b4e9-931f13edd0f2.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/476af51f-66ed-469d-b4e9-931f13edd0f2.wav differ diff --git a/app/tmp/4a786e69-92b5-4614-8848-598fc1196509.wav b/app/tmp/4a786e69-92b5-4614-8848-598fc1196509.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/4a786e69-92b5-4614-8848-598fc1196509.wav differ diff --git a/app/tmp/4ab51bfe-8ae7-4404-8f76-c45324d18bc0.wav b/app/tmp/4ab51bfe-8ae7-4404-8f76-c45324d18bc0.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/4ab51bfe-8ae7-4404-8f76-c45324d18bc0.wav differ diff --git a/app/tmp/4b17d008-4fec-4a33-81c9-6f42472040ec.wav b/app/tmp/4b17d008-4fec-4a33-81c9-6f42472040ec.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/4b17d008-4fec-4a33-81c9-6f42472040ec.wav differ diff --git a/app/tmp/529e4122-f1fb-4bbb-91d2-8b90faf2d244.wav b/app/tmp/529e4122-f1fb-4bbb-91d2-8b90faf2d244.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/529e4122-f1fb-4bbb-91d2-8b90faf2d244.wav differ diff --git a/app/tmp/5c448017-8d30-4b57-8f87-58026a9a7aac.wav b/app/tmp/5c448017-8d30-4b57-8f87-58026a9a7aac.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/5c448017-8d30-4b57-8f87-58026a9a7aac.wav differ diff --git a/app/tmp/5f8e83b8-1bb4-460f-aa4a-40e97ff4979b.wav b/app/tmp/5f8e83b8-1bb4-460f-aa4a-40e97ff4979b.wav new file mode 100644 index 0000000000000000000000000000000000000000..13e4eb823c9489f6e7a06bcb0aa0d8a017fc6378 Binary files /dev/null and b/app/tmp/5f8e83b8-1bb4-460f-aa4a-40e97ff4979b.wav differ diff --git a/app/tmp/687cab7a-94bc-4099-a804-f407e3a55e53.wav b/app/tmp/687cab7a-94bc-4099-a804-f407e3a55e53.wav new file mode 100644 index 0000000000000000000000000000000000000000..a995e1e9adb8b3dda8e8afa51c72003e42646412 Binary files /dev/null and b/app/tmp/687cab7a-94bc-4099-a804-f407e3a55e53.wav differ diff --git a/app/tmp/6c112e50-495c-4d1b-9ebc-1bd700f50a0d.wav b/app/tmp/6c112e50-495c-4d1b-9ebc-1bd700f50a0d.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/6c112e50-495c-4d1b-9ebc-1bd700f50a0d.wav differ diff --git a/app/tmp/8c4012cb-828a-49ef-b474-035cbe73019b.wav b/app/tmp/8c4012cb-828a-49ef-b474-035cbe73019b.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/8c4012cb-828a-49ef-b474-035cbe73019b.wav differ diff --git a/app/tmp/95631c14-8791-4aea-8283-cd86a6c29165.wav b/app/tmp/95631c14-8791-4aea-8283-cd86a6c29165.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/95631c14-8791-4aea-8283-cd86a6c29165.wav differ diff --git a/app/tmp/97eee9ad-0b9b-4e74-8772-296ef1d46366.wav b/app/tmp/97eee9ad-0b9b-4e74-8772-296ef1d46366.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/97eee9ad-0b9b-4e74-8772-296ef1d46366.wav differ diff --git a/app/tmp/9ba07350-4fa8-4b92-b673-be8da948255e.wav b/app/tmp/9ba07350-4fa8-4b92-b673-be8da948255e.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/9ba07350-4fa8-4b92-b673-be8da948255e.wav differ diff --git a/app/tmp/a3a357db-64fa-456a-ad15-d3ebf808c07e.wav b/app/tmp/a3a357db-64fa-456a-ad15-d3ebf808c07e.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/a3a357db-64fa-456a-ad15-d3ebf808c07e.wav differ diff --git a/app/tmp/a70c9adf-839e-4851-9bcb-a4792f8c7262.wav b/app/tmp/a70c9adf-839e-4851-9bcb-a4792f8c7262.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/a70c9adf-839e-4851-9bcb-a4792f8c7262.wav differ diff --git a/app/tmp/audio.wav b/app/tmp/audio.wav new file mode 100644 index 0000000000000000000000000000000000000000..9c3c6f6c71bcf68c134983863604b984318ad2d2 Binary files /dev/null and b/app/tmp/audio.wav differ diff --git a/app/tmp/b470e34d-d280-48fe-96b7-01b36f11442f.wav b/app/tmp/b470e34d-d280-48fe-96b7-01b36f11442f.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/b470e34d-d280-48fe-96b7-01b36f11442f.wav differ diff --git a/app/tmp/bee4d343-7c2a-420a-86d4-ed8f837f0d00.wav b/app/tmp/bee4d343-7c2a-420a-86d4-ed8f837f0d00.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/bee4d343-7c2a-420a-86d4-ed8f837f0d00.wav differ diff --git a/app/tmp/ca9f834c-13f4-4437-b3d2-9eade0d9539f.wav b/app/tmp/ca9f834c-13f4-4437-b3d2-9eade0d9539f.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/ca9f834c-13f4-4437-b3d2-9eade0d9539f.wav differ diff --git a/app/tmp/d3564941-6849-4635-ac4e-a76016f3711a.wav b/app/tmp/d3564941-6849-4635-ac4e-a76016f3711a.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/d3564941-6849-4635-ac4e-a76016f3711a.wav differ diff --git a/app/tmp/d39d61f0-8756-4247-8dc2-5186b878c64c.wav b/app/tmp/d39d61f0-8756-4247-8dc2-5186b878c64c.wav new file mode 100644 index 0000000000000000000000000000000000000000..00cc1ae354110a26789c3eeb401e99cc51e61bba Binary files /dev/null and b/app/tmp/d39d61f0-8756-4247-8dc2-5186b878c64c.wav differ diff --git a/app/tmp/da436c70-cfbc-4e2f-a6c3-6e79a93764f5.wav b/app/tmp/da436c70-cfbc-4e2f-a6c3-6e79a93764f5.wav new file mode 100644 index 0000000000000000000000000000000000000000..ee87fcfa5613337c10d75ea36e5cf85e22ee39d3 Binary files /dev/null and b/app/tmp/da436c70-cfbc-4e2f-a6c3-6e79a93764f5.wav differ diff --git a/app/tmp/dc0d4e45-30db-4f33-a469-1599ac7134ae.wav b/app/tmp/dc0d4e45-30db-4f33-a469-1599ac7134ae.wav new file mode 100644 index 0000000000000000000000000000000000000000..449182d77f4c7df05f3463d736fc07b3af9c1abf Binary files /dev/null and b/app/tmp/dc0d4e45-30db-4f33-a469-1599ac7134ae.wav differ diff --git a/app/tmp/e7d0cbe1-2261-4f4e-8aa0-05f02e024040.wav b/app/tmp/e7d0cbe1-2261-4f4e-8aa0-05f02e024040.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/e7d0cbe1-2261-4f4e-8aa0-05f02e024040.wav differ diff --git a/app/tmp/ea2b6cc3-bc2f-4203-bfec-699488f6cc27.wav b/app/tmp/ea2b6cc3-bc2f-4203-bfec-699488f6cc27.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/ea2b6cc3-bc2f-4203-bfec-699488f6cc27.wav differ diff --git a/app/tmp/f42c7629-063d-4504-b306-56700f8a2358.wav b/app/tmp/f42c7629-063d-4504-b306-56700f8a2358.wav new file mode 100644 index 0000000000000000000000000000000000000000..f305154376d19463c7ef63941b94ac7f2d74bfd7 Binary files /dev/null and b/app/tmp/f42c7629-063d-4504-b306-56700f8a2358.wav differ diff --git a/app/tmp/test.mp3 b/app/tmp/test.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..2136428a25b7c865fbaa82b7adeb53ec7dfd55d9 Binary files /dev/null and b/app/tmp/test.mp3 differ diff --git a/app/wsgi.py b/app/wsgi.py new file mode 100644 index 0000000000000000000000000000000000000000..a615ba787f85cfe08b5464b24cf9e9636e63f714 --- /dev/null +++ b/app/wsgi.py @@ -0,0 +1,4 @@ +from app import app + +if __name__ == '__main__': + app.run() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1329da6b72bc9e12b9b392ff9ccc41773628850 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +transformers +accelerate +torch +whisper +Flask +Flask-Cors +faster-whisper \ No newline at end of file