Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from huggingface_hub import InferenceApi, login, InferenceClient
|
|
| 6 |
# Streamlit app configuration
|
| 7 |
st.set_page_config(page_title="Medical Chatbot")
|
| 8 |
st.title("Medical Chatbot 🤖")
|
| 9 |
-
|
| 10 |
# Get the Hugging Face token from environment variables
|
| 11 |
hf_token = os.getenv("HF_TOKEN")
|
| 12 |
if hf_token is None:
|
|
@@ -54,11 +54,10 @@ if 'messages' not in st.session_state:
|
|
| 54 |
{"role": "system", "content": "You are a knowledgeable and empathetic medical assistant providing accurate and compassionate health advice based on user input."}
|
| 55 |
]
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
st.subheader("", divider='rainbow')
|
| 62 |
|
| 63 |
def respond(message, history, max_tokens, temperature, top_p):
|
| 64 |
# Prepare the list of messages for the chat completion
|
|
|
|
| 6 |
# Streamlit app configuration
|
| 7 |
st.set_page_config(page_title="Medical Chatbot")
|
| 8 |
st.title("Medical Chatbot 🤖")
|
| 9 |
+
st.subheader("", divider='rainbow')
|
| 10 |
# Get the Hugging Face token from environment variables
|
| 11 |
hf_token = os.getenv("HF_TOKEN")
|
| 12 |
if hf_token is None:
|
|
|
|
| 54 |
{"role": "system", "content": "You are a knowledgeable and empathetic medical assistant providing accurate and compassionate health advice based on user input."}
|
| 55 |
]
|
| 56 |
|
| 57 |
+
Display chat history
|
| 58 |
+
for message in st.session_state.messages:
|
| 59 |
+
with st.chat_message(message["role"]):
|
| 60 |
+
st.markdown(message["content"])
|
|
|
|
| 61 |
|
| 62 |
def respond(message, history, max_tokens, temperature, top_p):
|
| 63 |
# Prepare the list of messages for the chat completion
|