Update src/streamlit_app.py
Browse files- src/streamlit_app.py +28 -39
src/streamlit_app.py
CHANGED
|
@@ -1,40 +1,29 @@
|
|
| 1 |
-
import
|
| 2 |
-
import numpy as np
|
| 3 |
-
import pandas as pd
|
| 4 |
import streamlit as st
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
st.altair_chart(alt.Chart(df, height=700, width=700)
|
| 34 |
-
.mark_point(filled=True)
|
| 35 |
-
.encode(
|
| 36 |
-
x=alt.X("x", axis=None),
|
| 37 |
-
y=alt.Y("y", axis=None),
|
| 38 |
-
color=alt.Color("idx", legend=None, scale=alt.Scale()),
|
| 39 |
-
size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),
|
| 40 |
-
))
|
|
|
|
| 1 |
+
import os
|
|
|
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
+
from streamlit_chat_widget import chat_input_widget
|
| 4 |
+
|
| 5 |
+
def app():
|
| 6 |
+
st.title("Doctor AI Assistant")
|
| 7 |
+
|
| 8 |
+
if "chat_history" not in st.session_state:
|
| 9 |
+
st.session_state.chat_history = [
|
| 10 |
+
"Hello! I am your Doctor AI Assistant. How can I help you?"
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
# Display chat history
|
| 14 |
+
for message in st.session_state.chat_history:
|
| 15 |
+
st.write(message)
|
| 16 |
+
|
| 17 |
+
# Display the chat input widget at the bottom
|
| 18 |
+
user_input = chat_input_widget()
|
| 19 |
+
|
| 20 |
+
if user_input:
|
| 21 |
+
if "text" in user_input:
|
| 22 |
+
user_text =user_input["text"]
|
| 23 |
+
st.session_state.chat_history.append(f"You: {user_text}")
|
| 24 |
+
elif "audioFile" in user_input:
|
| 25 |
+
audio_bytes = bytes(user_input["audioFile"])
|
| 26 |
+
st.audio(audio_bytes)
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
app()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|