ajitesh123 / Perf-Review-AI

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

Audi support from issue #52

Open ajitesh123 opened 1 week ago

ajitesh123 commented 1 week ago

Add the ability for users to provide audio input for their performance reviews and self-reviews. Previously, users had to type their input, but now they can record their audio. You can use streamlit audio-record (https://github.com/stefanrmmr/streamlit-audio-recorder) for this.

The audio should be converted from speech to text using the Whisper model on Groq library (https://console.groq.com/docs/speech-text), and the resulting text will be used as input to the review generation process.\n\nMain Changes:

greptile-apps[bot] commented 1 week ago

Implementation Steps

  1. Add Streamlit Audio Recorder in app.py:
import streamlit as st
from streamlit_audio_recorder import audio_recorder

# Inside the Performance Review section
if review_type == "Performance Review":
    st.title("Write Performance Review in a Minute")

    audio_review = audio_recorder()
    if audio_review:
        audio_text = convert_speech_to_text(audio_review)
        st.text_area('Audio Review Text', value=audio_text, height=200)

    # Existing code...
  1. Implement convert_speech_to_text function in llm.py:
class GroqLLM(LLM):
    # Existing code...

    def convert_speech_to_text(self, audio_data: bytes) -> str:
        response = self.client.speech_to_text(audio_data)
        return response['text']
  1. Update ReviewRequest and SelfReviewRequest models in review.py and self_review.py:
class ReviewRequest(BaseModel):
    # Existing fields...
    audio_review: Optional[bytes] = None

class SelfReviewRequest(BaseModel):
    # Existing fields...
    audio_review: Optional[bytes] = None
  1. Modify prompt generation to include audio_review in review.py and self_review.py:
def generate_prompt(your_role, candidate_role, perf_question, your_review, audio_review=None):
    if audio_review:
        your_review += f"\n\nAudio Review: {audio_review}"
    # Existing code...
def generate_self_review_prompt(text_dump, questions, instructions, audio_review=None):
    if audio_review:
        text_dump += f"\n\nAudio Review: {audio_review}"
    # Existing code...

References

/app.py /llm.py /review.py /self_review.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)