Skip to content

Commit

Permalink
chore(debug): remove extra logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ijemmao committed Sep 22, 2024
1 parent b62a0d6 commit 92f3363
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 11 deletions.
2 changes: 0 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ const dialects = dataset.flatMap((word) => {
return { dialects: word.dialects, variations: word.variations || [] };
});

// console.log(dialects);

fs.writeFileSync('igbo-api-dialects.json', JSON.stringify(dialects, null, 2));
6 changes: 0 additions & 6 deletions src/controllers/speechToText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface Prediction {
*/
export const getTranscription: MiddleWare = async (req, res, next) => {
try {
console.log('what is here?', req.body);
const { audioUrl: audio } = req.body;
if (!audio.startsWith('https://') && !audio.startsWith('data:audio')) {
console.log('Audio URL must either be hosted publicly or a valid base64');
Expand All @@ -34,7 +33,6 @@ export const getTranscription: MiddleWare = async (req, res, next) => {

// If the audio doesn't come from Igbo API S3, we will pass into IgboSpeech
if (!audio.includes('igbo-api.s3.us-east-2')) {
console.log('about to upload audio via IgboSpeech');
const { data: response } = await axios
.request<AudioMetadata>({
method: 'POST',
Expand All @@ -52,12 +50,10 @@ export const getTranscription: MiddleWare = async (req, res, next) => {

payload = { id: response.audioId, url: response.audioUrl };
} else {
console.log('nvm going to use the audio uri');
const audioId = parseAWSIdFromUri(audio);
payload = { id: audioId, url: audio };
}

console.log('about to predict');
// Talks to prediction endpoint
const { data: response } = await axios.request<Prediction>({
method: 'POST',
Expand All @@ -68,11 +64,9 @@ export const getTranscription: MiddleWare = async (req, res, next) => {
},
data: payload,
});
console.log('done with the prediction');

return res.send({ transcription: response.transcription });
} catch (err) {
console.log('error within speechToText', err);
return next();
}
};
3 changes: 0 additions & 3 deletions src/middleware/validateApiKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const validateApiKey: MiddleWare = async (req, res, next) => {
/* Official sites can bypass validation */
if (apiKey === MAIN_KEY) {
req.isUsingMainKey = true;
console.log('Using the main key');
return next();
}
req.isUsingMainKey = false;
Expand All @@ -32,15 +31,13 @@ const validateApiKey: MiddleWare = async (req, res, next) => {
const developer = await findDeveloper(apiKey);

if (!developer) {
console.log('no developer found');
return res.status(401).send({ error: 'Your API key is invalid' });
}

await authorizeDeveloperUsage({ route: req.route, developer });

return next();
} catch (err: any) {
console.log('error within validateApiKey', err);
res.status(400);
return res.send({ error: err.message });
}
Expand Down

0 comments on commit 92f3363

Please sign in to comment.