Skip to content

Commit

Permalink
Finishing touches to images
Browse files Browse the repository at this point in the history
  • Loading branch information
RJain12 committed Oct 22, 2023
1 parent a10ffef commit 0c0d26b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.DS_Store
config.js
config.js
server.js
config.json
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"accessKeyId": "AKIA4W33EIKGOE337FE4",
"secretAccessKey": "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",
"accessKeyId": "AKIA4W33EIKGJJHZP4HD",
"secretAccessKey": "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",
"region": "us-east-1"
}
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ app.get('/viewer2', (req, res) => {

const axios = require('axios');

const api_key = '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';
const api_key = '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';

app.get('/gpt', async (req, res) => {
const prompt = req.query.prompt;
Expand Down
Binary file modified src/site/speech_0.mp3
Binary file not shown.
Binary file modified src/site/speech_1.mp3
Binary file not shown.
21 changes: 13 additions & 8 deletions src/site/viewer2.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,19 @@
<script src="https://unpkg.com/axios/dist/axios.min.js">
</script>

<script>
function changeImage(imageSrc) {
const skyElement = document.getElementById('sky');
skyElement.setAttribute('src', imageSrc);
}
</script>

<script>
const arr = [
"https://raw.githubusercontent.com/RJain12/shanti/main/src/assets/sculpture.webp",
"https://raw.githubusercontent.com/RJain12/shanti/main/src/assets/church.jpeg",
"https://raw.githubusercontent.com/RJain12/shanti/main/src/assets/lake.jpeg"
];
let i = 0;
let good;

Expand All @@ -86,13 +98,13 @@
axios.get(`/gpt?prompt=You are a professional therapist who is taking your patient along a therapeutic journey. You offer succinct, positive, calming advice to them. Your patient says the following transcript "${text}"" and you respond with the following succinct response`).then(data => {
if(data !== 0) {
text = data.data;
console.log(text)
axios.get(`/tts?prompt=${text}&val=${i}`).then(data=> {
setTimeout(function() {
}, 1500);
var audio = new Audio(`/site/speech_${i}.mp3`);
speechRecognition.stop();
audio.play();
changeImage(arr[i%3]);
good = 0;
if (!audio.duration) {
setTimeout(function(){
Expand Down Expand Up @@ -137,12 +149,5 @@
}
};
</script>

<script>
function changeImage(imageSrc) {
const skyElement = document.getElementById('sky');
skyElement.setAttribute('src', imageSrc);
}
</script>
</body>
</html>

0 comments on commit 0c0d26b

Please sign in to comment.