Spaces:
Sleeping
Sleeping
Commit
·
fcd8049
1
Parent(s):
8850406
Update Evolusis AI Agent with enhanced features
Browse files- Improved audio transcription with better file format handling
- Added Loom video demonstration link
- Enhanced error messages for better user experience
- Merged improvements from GitHub repository
README.md
CHANGED
|
@@ -9,10 +9,9 @@ pinned: false
|
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
# Evolusis AI Agent
|
| 15 |
-
|
|
|
|
| 16 |
Backend Developer Assignment - AI-powered chat assistant with LLM reasoning and external API integration.
|
| 17 |
|
| 18 |
## 🎯 Overview
|
|
|
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 11 |
|
|
|
|
|
|
|
| 12 |
# Evolusis AI Agent
|
| 13 |
+
## Live Deployement - https://yashgori20-evolusis.hf.space
|
| 14 |
+
## Loom Video - https://www.loom.com/share/57867c0d51be40f48e47646023ceaeb0
|
| 15 |
Backend Developer Assignment - AI-powered chat assistant with LLM reasoning and external API integration.
|
| 16 |
|
| 17 |
## 🎯 Overview
|
app.py
CHANGED
|
@@ -87,9 +87,25 @@ class ToolRegistry:
|
|
| 87 |
try:
|
| 88 |
if not groq_client:
|
| 89 |
return None
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
transcription = groq_client.audio.transcriptions.create(
|
| 92 |
-
file=
|
| 93 |
model="whisper-large-v3-turbo",
|
| 94 |
response_format="text"
|
| 95 |
)
|
|
@@ -775,7 +791,7 @@ if True:
|
|
| 775 |
process_query(transcription)
|
| 776 |
st.rerun()
|
| 777 |
else:
|
| 778 |
-
st.error("Failed to transcribe audio. Please check your GROQ_API_KEY.")
|
| 779 |
|
| 780 |
# Text input
|
| 781 |
user_input = st.text_input("⌨️ Or type your question...", key="chat_input_text")
|
|
@@ -859,10 +875,11 @@ if True:
|
|
| 859 |
with st.spinner("🎧 Transcribing your voice..."):
|
| 860 |
transcription = agent.tools.transcribe_audio(audio_input)
|
| 861 |
if transcription:
|
|
|
|
| 862 |
process_query(transcription)
|
| 863 |
st.rerun()
|
| 864 |
else:
|
| 865 |
-
st.error("Failed to transcribe audio. Please check your GROQ_API_KEY.")
|
| 866 |
|
| 867 |
# Text input for follow-up
|
| 868 |
user_input = st.text_input("⌨️ Continue the conversation...", key="followup_text")
|
|
|
|
| 87 |
try:
|
| 88 |
if not groq_client:
|
| 89 |
return None
|
| 90 |
+
|
| 91 |
+
# Ensure file pointer is at the beginning
|
| 92 |
+
if hasattr(audio_file, 'seek'):
|
| 93 |
+
audio_file.seek(0)
|
| 94 |
+
|
| 95 |
+
# Get the original filename or create a default one with proper extension
|
| 96 |
+
# Streamlit's audio_input typically records in WAV format
|
| 97 |
+
filename = getattr(audio_file, 'name', 'audio.wav')
|
| 98 |
+
|
| 99 |
+
# Ensure filename has an extension
|
| 100 |
+
if not any(filename.lower().endswith(ext) for ext in ['.wav', '.mp3', '.webm', '.m4a', '.ogg']):
|
| 101 |
+
filename = 'audio.wav'
|
| 102 |
+
|
| 103 |
+
# Create a tuple with (filename, file_object) for Groq API
|
| 104 |
+
# This ensures Groq can properly detect the audio format
|
| 105 |
+
file_tuple = (filename, audio_file)
|
| 106 |
+
|
| 107 |
transcription = groq_client.audio.transcriptions.create(
|
| 108 |
+
file=file_tuple,
|
| 109 |
model="whisper-large-v3-turbo",
|
| 110 |
response_format="text"
|
| 111 |
)
|
|
|
|
| 791 |
process_query(transcription)
|
| 792 |
st.rerun()
|
| 793 |
else:
|
| 794 |
+
st.error("Failed to transcribe audio. Please check your GROQ_API_KEY and audio format.")
|
| 795 |
|
| 796 |
# Text input
|
| 797 |
user_input = st.text_input("⌨️ Or type your question...", key="chat_input_text")
|
|
|
|
| 875 |
with st.spinner("🎧 Transcribing your voice..."):
|
| 876 |
transcription = agent.tools.transcribe_audio(audio_input)
|
| 877 |
if transcription:
|
| 878 |
+
st.success(f"You said: {transcription}")
|
| 879 |
process_query(transcription)
|
| 880 |
st.rerun()
|
| 881 |
else:
|
| 882 |
+
st.error("Failed to transcribe audio. Please check your GROQ_API_KEY and audio format.")
|
| 883 |
|
| 884 |
# Text input for follow-up
|
| 885 |
user_input = st.text_input("⌨️ Continue the conversation...", key="followup_text")
|