Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,9 @@ if "chat_session" not in st.session_state:
|
|
41 |
if "display_history" not in st.session_state:
|
42 |
st.session_state.display_history = []
|
43 |
|
|
|
|
|
|
|
44 |
def process_audio(audio_data):
|
45 |
"""Verarbeitet Audiodaten und gibt Transkript zurück."""
|
46 |
try:
|
@@ -93,7 +96,8 @@ if audio_bytes:
|
|
93 |
full_prompt = f"{transcription}\nAntworte immer auf Deutsch"
|
94 |
response = st.session_state.chat_session.send_message(full_prompt)
|
95 |
response_text = response.candidates[0].content.parts[0].text if response.candidates else "Keine Antwort"
|
96 |
-
|
|
|
97 |
#st.session_state.display_history.append(("assistant", response_text))
|
98 |
#st.rerun()
|
99 |
except Exception as e:
|
@@ -106,6 +110,7 @@ if user_input:
|
|
106 |
full_prompt = f"{user_input}\nAntworte immer auf Deutsch\n antworte kurz und knapp."
|
107 |
response = st.session_state.chat_session.send_message(full_prompt)
|
108 |
response_text = response.candidates[0].content.parts[0].text if response.candidates else "Keine Antwort"
|
109 |
-
|
|
|
110 |
#st.session_state.display_history.append(("assistant", response_text))
|
111 |
#st.rerun()
|
|
|
41 |
if "display_history" not in st.session_state:
|
42 |
st.session_state.display_history = []
|
43 |
|
44 |
+
|
45 |
+
messages = st.container()
|
46 |
+
|
47 |
def process_audio(audio_data):
|
48 |
"""Verarbeitet Audiodaten und gibt Transkript zurück."""
|
49 |
try:
|
|
|
96 |
full_prompt = f"{transcription}\nAntworte immer auf Deutsch"
|
97 |
response = st.session_state.chat_session.send_message(full_prompt)
|
98 |
response_text = response.candidates[0].content.parts[0].text if response.candidates else "Keine Antwort"
|
99 |
+
messages.chat_message("assistant").write(f"{response_text}")
|
100 |
+
#st.write(response_text)
|
101 |
#st.session_state.display_history.append(("assistant", response_text))
|
102 |
#st.rerun()
|
103 |
except Exception as e:
|
|
|
110 |
full_prompt = f"{user_input}\nAntworte immer auf Deutsch\n antworte kurz und knapp."
|
111 |
response = st.session_state.chat_session.send_message(full_prompt)
|
112 |
response_text = response.candidates[0].content.parts[0].text if response.candidates else "Keine Antwort"
|
113 |
+
messages.chat_message("assistant").write(f"{response_text}")
|
114 |
+
#st.markdown(response_text)
|
115 |
#st.session_state.display_history.append(("assistant", response_text))
|
116 |
#st.rerun()
|