ajitesh123 / Perf-Review-AI

Write perf reviews in a minute
https://perfor-ai.streamlit.app/
2 stars 1 forks source link

Add Audio Input for Performance and Self-Reviews #56

Open archie-ai-code-explain-pr-review[bot] opened 1 week ago

archie-ai-code-explain-pr-review[bot] commented 1 week ago
greptile-apps[bot] commented 1 week ago

Implementation Steps

  1. Install streamlit-audio-recorder Library

    pip install streamlit-audio-recorder
  2. Update ReviewRequest and SelfReviewRequest Models

    • Add an optional audio_review field to both models in review.py and self_review.py.
      class ReviewRequest(BaseModel):
      your_role: str
      candidate_role: str
      perf_question: Optional[str] = None
      your_review: str
      audio_review: Optional[bytes] = None  # New field
      llm_type: str
      user_api_key: str
      model_size: str = "small"
      class SelfReviewRequest(BaseModel):
      text_dump: str
      questions: List[str]
      instructions: Optional[str] = None
      audio_review: Optional[bytes] = None  # New field
      llm_type: str
      user_api_key: str
      model_size: str = "medium"
  3. Add Audio Recorder to Streamlit UI in app.py

    from streamlit_audio_recorder import audio_recorder
    
    audio_review = audio_recorder()
    • Add this to both the Performance Review and Self-Review sections.
  4. Implement convert_speech_to_text Function in llm.py

    def convert_speech_to_text(audio_data: bytes) -> str:
       from groq import Whisper
       whisper = Whisper(api_key=GROQ_API_KEY)
       return whisper.transcribe(audio_data)
  5. Update Review Generation Logic in app.py

    • Modify the generate_review and generate_self_review calls to handle audio_review.
      if audio_review:
      your_review = convert_speech_to_text(audio_review)
    • Add this before creating the ReviewRequest or SelfReviewRequest objects.

References

/app.py /self_review.py /review.py /llm.py

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/ajitesh123/perf-review-ai/main) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)