Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,12 +14,12 @@ llm = HuggingFaceHub(repo_id="suriya7/MaxMini-Instruct-248M",
|
|
14 |
})
|
15 |
|
16 |
|
17 |
-
template = """
|
18 |
-
|
19 |
-
|
20 |
-
Human:
|
21 |
-
|
22 |
-
"""
|
23 |
|
24 |
prompt = PromptTemplate(template=template,input_variables=['question','previous_history'])
|
25 |
|
@@ -45,10 +45,10 @@ st.info("MaxMini-Instruct-248M is a T5 (Text-To-Text Transfer Transformer) model
|
|
45 |
|
46 |
st.session_state['history'] = []
|
47 |
|
48 |
-
if '
|
49 |
-
st.session_state['
|
50 |
|
51 |
-
st.session_state['
|
52 |
|
53 |
|
54 |
# Create containers for chat history and user input
|
@@ -61,14 +61,14 @@ with container:
|
|
61 |
if user_input:
|
62 |
output = conversational_chat(user_input)
|
63 |
# answer = response_generator(output)
|
64 |
-
st.session_state['
|
65 |
-
st.session_state['
|
66 |
|
67 |
|
68 |
-
|
69 |
-
if st.session_state['
|
70 |
with response_container:
|
71 |
-
for i in range(len(st.session_state['
|
72 |
-
if i
|
73 |
-
message(st.session_state["
|
74 |
-
message(st.session_state["
|
|
|
14 |
})
|
15 |
|
16 |
|
17 |
+
template = """You are a friendly chatbot called "MAXMINI" who give clear an well having a conversation with a human and you are created by suriya an AI Enthusiastic.
|
18 |
+
previous chat:
|
19 |
+
{previous_history}
|
20 |
+
Human:
|
21 |
+
{question}
|
22 |
+
Chatbot:"""
|
23 |
|
24 |
prompt = PromptTemplate(template=template,input_variables=['question','previous_history'])
|
25 |
|
|
|
45 |
|
46 |
st.session_state['history'] = []
|
47 |
|
48 |
+
if 'assistant' not in st.session_state:
|
49 |
+
st.session_state['assistant'] = ['Hey There! How Can I Assist You']
|
50 |
|
51 |
+
st.session_state['human'] = [" "]
|
52 |
|
53 |
|
54 |
# Create containers for chat history and user input
|
|
|
61 |
if user_input:
|
62 |
output = conversational_chat(user_input)
|
63 |
# answer = response_generator(output)
|
64 |
+
st.session_state['human'].append(user_input)
|
65 |
+
st.session_state['assistant'].append(output)
|
66 |
|
67 |
|
68 |
+
## Display chat history
|
69 |
+
if st.session_state['assistant']:
|
70 |
with response_container:
|
71 |
+
for i in range(len(st.session_state['assistant'])):
|
72 |
+
if i < len(st.session_state["human"]): # Check if 'human' list has enough elements
|
73 |
+
message(st.session_state["human"][i], is_user=True, key=str(i) + '_user', avatar_style="adventurer")
|
74 |
+
message(st.session_state["assistant"][i], key=str(i), avatar_style="bottts")
|