forked from Anilabhimanyu/Edufrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assessment.py
29 lines (20 loc) · 886 Bytes
/
assessment.py
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 streamlit as st
from llm_model import chat_with_gpt,gpt_response
def assessment():
st.title("Chatbot Demo")
# Initialize message history
message_history = []
# User input
user_input = st.text_input("User Input",key="user_input")
# Chatbot response
if st.button("Send"):
message_history.append({"role": "user", "content": user_input})
# Generate response from chatbot
response = chat_with_gpt(message_history)
# Display chatbot response
st.text_area("Chatbot Response", value=response, height=200)
# Add user and chatbot responses to message history
message_history.append({"role": "user", "content": user_input})
message_history.append({"role": "assistant", "content": response})
# Clear user input
st.text_input("User Input", value="",key="user_input_new")