Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audi support from issue #52

Closed
ajitesh123 opened this issue Jul 8, 2024 · 1 comment
Closed

Audi support from issue #52

ajitesh123 opened this issue Jul 8, 2024 · 1 comment

Comments

@ajitesh123
Copy link
Owner

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:

  • Add streamlit audio-record app.py
  • Implemented the convert_speech_to_text function using Whisper model in Groq
  • Updated the ReviewRequest and SelfReviewRequest models to include an optional audio_review field and add to prompt for LLM to use it for generating review and self-review
  • Don't make changed to fastapi endpoint (app.fastapi.py file) for now.",
Copy link

greptile-apps bot commented Jul 8, 2024

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 · Edit Issue Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant