ASR / scratch /test_feedback_llm.py
MihirRPatil's picture
deploy: CDAC ASR backend with pitch/stress fix and LLM feedback
88a679b
Raw
History Blame Contribute Delete
1.24 kB
import sys
import asyncio
import logging
sys.path.append("/home/mihir/Codes/CDAC_ASR/product")
sys.path.append("/home/mihir/Codes/CDAC_ASR/product/backend")
# Set up environment variables for LLM query
import os
if not os.getenv("OPENROUTER_API_KEY"):
os.environ["OPENROUTER_API_KEY"] = "sk-or-v1-placeholder" # placeholder if not set
from backend.services.llm import simplify_pronunciation_feedback
async def main():
test_feedback = [
"Pronunciation analysis detected 3 variant sounds: 2 substitutions and 1 omission.",
"• You pronounced 's' as 'ʃ' at position 2. Try adjusting your tongue shape to match the target sound.",
"• You omitted the expected sound 't' at position 5. Try to fully articulate it.",
"• Pitch Curve: Your intonation curve differs significantly from the reference. Focus on native-like sentence stress."
]
print("Testing feedback simplification...")
result = await simplify_pronunciation_feedback(test_feedback[1:])
print("\n--- ORIGINAL TECHNICAL TIPS ---")
for line in test_feedback[1:]:
print(line)
print("\n--- LLM SIMPLIFIED COACHING NOTE ---")
print(result)
if __name__ == "__main__":
asyncio.run(main())