arnabg95 commited on
Commit
b82152e
1 Parent(s): 82f2206

modification to the params

Browse files
app/__pycache__/passing.cpython-310.pyc CHANGED
Binary files a/app/__pycache__/passing.cpython-310.pyc and b/app/__pycache__/passing.cpython-310.pyc differ
 
app/passing.py CHANGED
@@ -19,8 +19,8 @@ def calculate_passing(sequence, phonetic, cosine=0, euclidean=0, passing_thresho
19
  weights = {
20
  'sequence': 0.35,
21
  'phonetic': 0.35,
22
- 'cosine': 0.15,
23
- 'euclidean': 0.15
24
  }
25
 
26
  weighted_score = (
 
19
  weights = {
20
  'sequence': 0.35,
21
  'phonetic': 0.35,
22
+ 'cosine': 0,
23
+ 'euclidean': 0
24
  }
25
 
26
  weighted_score = (
app/routers/V1/voice/__pycache__/voice_router.cpython-310.pyc CHANGED
Binary files a/app/routers/V1/voice/__pycache__/voice_router.cpython-310.pyc and b/app/routers/V1/voice/__pycache__/voice_router.cpython-310.pyc differ
 
app/routers/V1/voice/voice_router.py CHANGED
@@ -22,26 +22,26 @@ async def transcribe_audio(
22
  matcher_text: Annotated[str, Body()],
23
  ):
24
  try:
25
- # Validate URL
26
- if not original_url.endswith(".wav"):
27
- raise HTTPException(
28
- status_code=status.HTTP_400_BAD_REQUEST,
29
- detail="Invalid URL. Please provide a URL pointing to a wav file.",
30
- )
31
 
32
- # Download the audio file from the URL
33
- response = requests.get(original_url)
34
- if response.status_code != 200:
35
- raise HTTPException(
36
- status_code=status.HTTP_400_BAD_REQUEST,
37
- detail="Unable to download the audio file from the URL.",
38
- )
39
 
40
- filename_original = f"audio_{int(time.time())}_original.wav"
41
 
42
- # Save the downloaded file temporarily
43
- with open(filename_original, "wb") as buffer:
44
- buffer.write(response.content)
45
 
46
  # Read file bytes
47
  recorded_bytes = await recorded.read()
@@ -55,8 +55,7 @@ async def transcribe_audio(
55
  text = get_transcription(filename_recorded)
56
  text = clean_transcription(text)
57
  sequence, phonetic = match(matcher_text, text)
58
- Euclidean, Cosine = mfcc_similarty_check(filename_original, filename_recorded)
59
- weighted_score, is_passing = calculate_passing(sequence, phonetic, Cosine, Euclidean)
60
  return JSONResponse(
61
  {
62
  "transcription": text,
@@ -66,7 +65,7 @@ async def transcribe_audio(
66
  )
67
  finally:
68
  # Clean up the temporary file
69
- os.remove(filename_original)
70
  os.remove(filename_recorded)
71
 
72
  except Exception as e:
 
22
  matcher_text: Annotated[str, Body()],
23
  ):
24
  try:
25
+ # # Validate URL
26
+ # if not original_url.endswith(".wav"):
27
+ # raise HTTPException(
28
+ # status_code=status.HTTP_400_BAD_REQUEST,
29
+ # detail="Invalid URL. Please provide a URL pointing to a wav file.",
30
+ # )
31
 
32
+ # # Download the audio file from the URL
33
+ # response = requests.get(original_url)
34
+ # if response.status_code != 200:
35
+ # raise HTTPException(
36
+ # status_code=status.HTTP_400_BAD_REQUEST,
37
+ # detail="Unable to download the audio file from the URL.",
38
+ # )
39
 
40
+ # filename_original = f"audio_{int(time.time())}_original.wav"
41
 
42
+ # # Save the downloaded file temporarily
43
+ # with open(filename_original, "wb") as buffer:
44
+ # buffer.write(response.content)
45
 
46
  # Read file bytes
47
  recorded_bytes = await recorded.read()
 
55
  text = get_transcription(filename_recorded)
56
  text = clean_transcription(text)
57
  sequence, phonetic = match(matcher_text, text)
58
+ weighted_score, is_passing = calculate_passing(sequence, phonetic)
 
59
  return JSONResponse(
60
  {
61
  "transcription": text,
 
65
  )
66
  finally:
67
  # Clean up the temporary file
68
+ # os.remove(filename_original)
69
  os.remove(filename_recorded)
70
 
71
  except Exception as e: