Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -918,49 +918,6 @@ def main():
|
|
| 918 |
arxiv_results = perform_ai_lookup(st.session_state.voice_transcript)
|
| 919 |
st.markdown(arxiv_results)
|
| 920 |
|
| 921 |
-
# Clear transcript button
|
| 922 |
-
#if st.button("Clear Transcript"):
|
| 923 |
-
# st.session_state.voice_transcript = ""
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
# Handle speech recognition output
|
| 927 |
-
if speech_component:
|
| 928 |
-
try:
|
| 929 |
-
data = speech_component
|
| 930 |
-
if isinstance(data, dict):
|
| 931 |
-
if data.get('type') == 'final_transcript':
|
| 932 |
-
text = data.get('text', '').strip()
|
| 933 |
-
if text:
|
| 934 |
-
st.session_state.last_voice_input = text
|
| 935 |
-
|
| 936 |
-
# Process voice input with AI
|
| 937 |
-
st.subheader("AI Response to Voice Input:")
|
| 938 |
-
|
| 939 |
-
col1, col2, col3 = st.columns(3)
|
| 940 |
-
with col2:
|
| 941 |
-
st.write("Claude-3.5 Sonnet:")
|
| 942 |
-
try:
|
| 943 |
-
claude_response = process_with_claude(text)
|
| 944 |
-
except:
|
| 945 |
-
st.write('Claude 3.5 Sonnet out of tokens.')
|
| 946 |
-
with col1:
|
| 947 |
-
st.write("GPT-4o Omni:")
|
| 948 |
-
try:
|
| 949 |
-
gpt_response = process_with_gpt(text)
|
| 950 |
-
except:
|
| 951 |
-
st.write('GPT 4o out of tokens')
|
| 952 |
-
with col3:
|
| 953 |
-
st.write("Arxiv and Mistral Research:")
|
| 954 |
-
with st.spinner("Searching ArXiv..."):
|
| 955 |
-
results = perform_ai_lookup(text)
|
| 956 |
-
st.markdown(results)
|
| 957 |
-
|
| 958 |
-
elif data.get('type') == 'clear_transcript':
|
| 959 |
-
st.session_state.last_voice_input = ""
|
| 960 |
-
st.experimental_rerun()
|
| 961 |
-
|
| 962 |
-
except Exception as e:
|
| 963 |
-
st.error(f"Error processing voice input: {e}")
|
| 964 |
|
| 965 |
# Display last voice input
|
| 966 |
if st.session_state.last_voice_input:
|
|
|
|
| 918 |
arxiv_results = perform_ai_lookup(st.session_state.voice_transcript)
|
| 919 |
st.markdown(arxiv_results)
|
| 920 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 921 |
|
| 922 |
# Display last voice input
|
| 923 |
if st.session_state.last_voice_input:
|