Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -50,7 +50,8 @@ st.markdown("""
|
|
50 |
""", unsafe_allow_html=True)
|
51 |
|
52 |
st.markdown('<div class="big-title">π§ Voice Agent Pro</div>', unsafe_allow_html=True)
|
53 |
-
st.markdown(
|
|
|
54 |
|
55 |
# Voice selection
|
56 |
st.sidebar.header("ποΈ Voice Settings")
|
@@ -60,6 +61,11 @@ tone_prompt = get_voice_prompt_style(voice_label)
|
|
60 |
font_size = st.sidebar.radio("Font Size", ["Normal", "Large"])
|
61 |
font_class = "big-answer" if font_size == "Large" else ""
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
# One-liners per voice
|
64 |
preview_lines = {
|
65 |
"grandma GG": "Back in my day, we didnβt need AI to sound this fabulous.",
|
@@ -72,20 +78,22 @@ preview_lines = {
|
|
72 |
|
73 |
preview_line = preview_lines.get(voice_label, "Testing voice.")
|
74 |
st.markdown(f"π§ <b>{voice_label}</b> says:", unsafe_allow_html=True)
|
75 |
-
st.markdown(f"_
|
76 |
|
77 |
# Stream preview audio (no autoplay)
|
78 |
try:
|
79 |
-
|
80 |
text=preview_line,
|
81 |
voice_id=voice_id,
|
82 |
model_id="eleven_multilingual_v2"
|
83 |
)
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
89 |
except Exception as e:
|
90 |
st.warning("Voice preview unavailable.")
|
91 |
logger.exception("π§ Voice preview error")
|
@@ -211,4 +219,4 @@ if st.button("π Summarize"):
|
|
211 |
st.audio(audio_path)
|
212 |
else:
|
213 |
st.error("β Audio file missing.")
|
214 |
-
logger.warning(f"β Missing audio file: {audio_path}")
|
|
|
50 |
""", unsafe_allow_html=True)
|
51 |
|
52 |
st.markdown('<div class="big-title">π§ Voice Agent Pro</div>', unsafe_allow_html=True)
|
53 |
+
st.markdown("""<div class="instructions">Ask a question <b>OR</b> paste a URL <b>OR</b> upload a file β and I'll summarize it in bullet points with expressive AI narration!</div>""", unsafe_allow_html=True)
|
54 |
+
|
55 |
|
56 |
# Voice selection
|
57 |
st.sidebar.header("ποΈ Voice Settings")
|
|
|
61 |
font_size = st.sidebar.radio("Font Size", ["Normal", "Large"])
|
62 |
font_class = "big-answer" if font_size == "Large" else ""
|
63 |
|
64 |
+
# Add Bolt attribution to sidebar
|
65 |
+
st.sidebar.markdown("---")
|
66 |
+
st.sidebar.markdown("β‘ Made with [bolt.new](https://bolt.new)")
|
67 |
+
|
68 |
+
|
69 |
# One-liners per voice
|
70 |
preview_lines = {
|
71 |
"grandma GG": "Back in my day, we didnβt need AI to sound this fabulous.",
|
|
|
78 |
|
79 |
preview_line = preview_lines.get(voice_label, "Testing voice.")
|
80 |
st.markdown(f"π§ <b>{voice_label}</b> says:", unsafe_allow_html=True)
|
81 |
+
st.markdown(f"_{preview_line}_", unsafe_allow_html=True)
|
82 |
|
83 |
# Stream preview audio (no autoplay)
|
84 |
try:
|
85 |
+
audio_stream = client.text_to_speech.convert(
|
86 |
text=preview_line,
|
87 |
voice_id=voice_id,
|
88 |
model_id="eleven_multilingual_v2"
|
89 |
)
|
90 |
+
|
91 |
+
full_audio_content = b""
|
92 |
+
for chunk in audio_stream:
|
93 |
+
full_audio_content += chunk
|
94 |
+
|
95 |
+
st.audio(full_audio_content)
|
96 |
+
|
97 |
except Exception as e:
|
98 |
st.warning("Voice preview unavailable.")
|
99 |
logger.exception("π§ Voice preview error")
|
|
|
219 |
st.audio(audio_path)
|
220 |
else:
|
221 |
st.error("β Audio file missing.")
|
222 |
+
logger.warning(f"β Missing audio file: {audio_path}")
|