Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,19 +15,11 @@ from typing import Optional, Dict, Any
|
|
| 15 |
from download import download_video_audio, delete_download
|
| 16 |
from st_audiorec import st_audiorec # Import the audio recorder component
|
| 17 |
|
| 18 |
-
st.set_page_config(
|
| 19 |
-
page_title="Meeting Notes",
|
| 20 |
-
page_icon="🧙♂️",
|
| 21 |
-
layout="wide",
|
| 22 |
-
initial_sidebar_state="expanded"
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
# Set max file size for audio uploads (40MB)
|
| 26 |
MAX_FILE_SIZE = 41943040 # 40MB
|
| 27 |
FILE_TOO_LARGE_MESSAGE = "File too large. Maximum size is 40MB."
|
| 28 |
|
| 29 |
# Load environment variables - will also load from Hugging Face secrets
|
| 30 |
-
|
| 31 |
load_dotenv()
|
| 32 |
|
| 33 |
# Initialize session states
|
|
@@ -43,6 +35,14 @@ if 'groq_client' not in st.session_state:
|
|
| 43 |
if 'transcription_error' not in st.session_state:
|
| 44 |
st.session_state.transcription_error = None
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
# Fixed model selections
|
| 47 |
LLM_MODEL = "deepseek-r1-distill-llama-70b"
|
| 48 |
TRANSCRIPTION_MODEL = "distil-whisper-large-v3-en"
|
|
@@ -219,7 +219,8 @@ def retry_with_exponential_backoff(max_tries=MAX_RETRIES, initial_wait=INITIAL_W
|
|
| 219 |
# Inform user of retry attempt
|
| 220 |
st.info(f"Retrying transcription... (Attempt {tries}/{max_tries})")
|
| 221 |
time.sleep(wait_with_jitter)
|
| 222 |
-
|
|
|
|
| 223 |
return wrapper
|
| 224 |
return decorator
|
| 225 |
|
|
@@ -322,9 +323,12 @@ def process_transcript(transcript):
|
|
| 322 |
Please analyze the following transcript and transform it into highly organized notes:
|
| 323 |
|
| 324 |
```
|
|
|
|
| 325 |
{transcript}
|
| 326 |
-
```
|
| 327 |
|
|
|
|
|
|
|
|
|
|
| 328 |
Create a well-structured document with the following sections:
|
| 329 |
|
| 330 |
# Executive Summary
|
|
@@ -521,7 +525,7 @@ def main():
|
|
| 521 |
|
| 522 |
# Add a button to transcribe the recorded audio
|
| 523 |
if st.button("Transcribe Recording", key="transcribe_rec"):
|
| 524 |
-
with st.spinner("Transcribing audio
|
| 525 |
try:
|
| 526 |
transcript = transcribe_audio_with_groq(wav_audio_data)
|
| 527 |
if transcript:
|
|
@@ -573,7 +577,7 @@ def main():
|
|
| 573 |
# Reset any previous transcription errors
|
| 574 |
st.session_state.transcription_error = None
|
| 575 |
|
| 576 |
-
with st.spinner("Transcribing audio
|
| 577 |
try:
|
| 578 |
transcript = transcribe_audio_with_groq(audio_file_path)
|
| 579 |
if transcript:
|
|
@@ -628,7 +632,7 @@ def main():
|
|
| 628 |
st.success("Video downloaded successfully!")
|
| 629 |
st.audio(audio_path)
|
| 630 |
|
| 631 |
-
with st.spinner("Transcribing audio
|
| 632 |
try:
|
| 633 |
transcript = transcribe_audio_with_groq(audio_path)
|
| 634 |
if transcript:
|
|
|
|
| 15 |
from download import download_video_audio, delete_download
|
| 16 |
from st_audiorec import st_audiorec # Import the audio recorder component
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Set max file size for audio uploads (40MB)
|
| 19 |
MAX_FILE_SIZE = 41943040 # 40MB
|
| 20 |
FILE_TOO_LARGE_MESSAGE = "File too large. Maximum size is 40MB."
|
| 21 |
|
| 22 |
# Load environment variables - will also load from Hugging Face secrets
|
|
|
|
| 23 |
load_dotenv()
|
| 24 |
|
| 25 |
# Initialize session states
|
|
|
|
| 35 |
if 'transcription_error' not in st.session_state:
|
| 36 |
st.session_state.transcription_error = None
|
| 37 |
|
| 38 |
+
# Set page configuration
|
| 39 |
+
st.set_page_config(
|
| 40 |
+
page_title="ScribeWizard 🧙♂️",
|
| 41 |
+
page_icon="🧙♂️",
|
| 42 |
+
layout="wide",
|
| 43 |
+
initial_sidebar_state="expanded"
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
# Fixed model selections
|
| 47 |
LLM_MODEL = "deepseek-r1-distill-llama-70b"
|
| 48 |
TRANSCRIPTION_MODEL = "distil-whisper-large-v3-en"
|
|
|
|
| 219 |
# Inform user of retry attempt
|
| 220 |
st.info(f"Retrying transcription... (Attempt {tries}/{max_tries})")
|
| 221 |
time.sleep(wait_with_jitter)
|
| 222 |
+
|
| 223 |
+
return None # This line should never be reached but is added to satisfy the function signature
|
| 224 |
return wrapper
|
| 225 |
return decorator
|
| 226 |
|
|
|
|
| 323 |
Please analyze the following transcript and transform it into highly organized notes:
|
| 324 |
|
| 325 |
```
|
| 326 |
+
|
| 327 |
{transcript}
|
|
|
|
| 328 |
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
```
|
| 332 |
Create a well-structured document with the following sections:
|
| 333 |
|
| 334 |
# Executive Summary
|
|
|
|
| 525 |
|
| 526 |
# Add a button to transcribe the recorded audio
|
| 527 |
if st.button("Transcribe Recording", key="transcribe_rec"):
|
| 528 |
+
with st.spinner("Transcribing audio with Groq..."):
|
| 529 |
try:
|
| 530 |
transcript = transcribe_audio_with_groq(wav_audio_data)
|
| 531 |
if transcript:
|
|
|
|
| 577 |
# Reset any previous transcription errors
|
| 578 |
st.session_state.transcription_error = None
|
| 579 |
|
| 580 |
+
with st.spinner("Transcribing audio with Groq..."):
|
| 581 |
try:
|
| 582 |
transcript = transcribe_audio_with_groq(audio_file_path)
|
| 583 |
if transcript:
|
|
|
|
| 632 |
st.success("Video downloaded successfully!")
|
| 633 |
st.audio(audio_path)
|
| 634 |
|
| 635 |
+
with st.spinner("Transcribing audio with Groq..."):
|
| 636 |
try:
|
| 637 |
transcript = transcribe_audio_with_groq(audio_path)
|
| 638 |
if transcript:
|