Open ajitesh123 opened 1 week ago
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...
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']
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
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...
/app.py /llm.py /review.py /self_review.py
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: