Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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]}") #
|
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 |
-
|
|
|
|
|
|
|
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 |
|
|