Spaces:
Sleeping
Sleeping
fahad11182
commited on
Commit
•
211a7b2
1
Parent(s):
2a1f982
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def generate_response(message, system_message, max_tokens, temperature, top_p):
|
|
26 |
tts.save(audio_file)
|
27 |
return response, audio_file
|
28 |
|
29 |
-
st.title("
|
30 |
|
31 |
message = st.text_input("Enter your message:")
|
32 |
system_message = st.text_input("System message:", value="You are a friendly Chatbot.")
|
@@ -37,4 +37,12 @@ top_p = st.slider("Top-p (nucleus sampling)", 0.1, 1.0, 0.95, step=0.05)
|
|
37 |
if st.button("Generate Response"):
|
38 |
response, audio_file = generate_response(message, system_message, max_tokens, temperature, top_p)
|
39 |
st.write(response)
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
tts.save(audio_file)
|
27 |
return response, audio_file
|
28 |
|
29 |
+
st.title("Hi (:")
|
30 |
|
31 |
message = st.text_input("Enter your message:")
|
32 |
system_message = st.text_input("System message:", value="You are a friendly Chatbot.")
|
|
|
37 |
if st.button("Generate Response"):
|
38 |
response, audio_file = generate_response(message, system_message, max_tokens, temperature, top_p)
|
39 |
st.write(response)
|
40 |
+
|
41 |
+
# Add HTML to autoplay the audio
|
42 |
+
audio_html = f"""
|
43 |
+
<audio autoplay>
|
44 |
+
<source src="data:audio/mpeg;base64,{open(audio_file, "rb").read().encode("base64").decode()}" type="audio/mp3">
|
45 |
+
Your browser does not support the audio element.
|
46 |
+
</audio>
|
47 |
+
"""
|
48 |
+
st.markdown(audio_html, unsafe_allow_html=True)
|