Khd-B commited on
Commit
9f1a422
1 Parent(s): 2a5fb30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -62,14 +62,15 @@ if st.button("Submit"):
62
  st.subheader("Top Matches:")
63
  for idx in I[0]:
64
  if idx < len(embeddings): # Ensure index is valid
65
- st.write(f"Match Index: {idx}, Distance: {D[0][idx]}") # You can display the match details
66
 
67
  # Convert response to speech
68
  response_text = f"You asked about '{query}' in {subject}. Here are your top matches."
69
  tts = gTTS(text=response_text, lang='en')
70
  tts.save("response.mp3")
71
- os.system("start response.mp3") # Adjust for different OS
72
 
73
- st.success("Response generated and spoken!")
 
 
 
74
 
75
- # Note: To handle errors or improve this further, add appropriate try-except blocks and validations.
 
62
  st.subheader("Top Matches:")
63
  for idx in I[0]:
64
  if idx < len(embeddings): # Ensure index is valid
65
+ st.write(f"Match Index: {idx}, Distance: {D[0][idx]}") # Display match details
66
 
67
  # Convert response to speech
68
  response_text = f"You asked about '{query}' in {subject}. Here are your top matches."
69
  tts = gTTS(text=response_text, lang='en')
70
  tts.save("response.mp3")
 
71
 
72
+ # Display audio controls (Streamlit doesn't support direct playback)
73
+ st.audio("response.mp3")
74
+
75
+ st.success("Response generated!")
76