T
File size: 834 Bytes
41cd254
d3ea1f1
41cd254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
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
import os
import streamlit as st
from streamlit_chat_widget import chat_input_widget

def app():
    st.title("Doctor AI Assistant")
    
    if "chat_history" not in st.session_state:
        st.session_state.chat_history = [
            "Hello! I am your Doctor AI Assistant. How can I help you?"
        ]

    # Display chat history
    for message in st.session_state.chat_history:
        st.write(message)

    # Display the chat input widget at the bottom
    user_input = chat_input_widget()

    if user_input:
        if "text" in user_input:
            user_text =user_input["text"]
            st.session_state.chat_history.append(f"You: {user_text}")
        elif "audioFile" in user_input:
            audio_bytes = bytes(user_input["audioFile"])
            st.audio(audio_bytes)

if __name__ == "__main__":
    app()