expandme commited on
Commit
f3002dd
·
1 Parent(s): 973c2a9

Editable 'Custom Instruction'

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -3,7 +3,7 @@ from huggingface_hub import InferenceClient
3
  import os
4
  import sys
5
 
6
- st.title("SmallZOO-ChatBot-3B")
7
 
8
  base_url="https://api-inference.huggingface.co/models/"
9
  API_KEY = os.environ.get('HG_Interference_API_TOKEN')
@@ -54,6 +54,12 @@ selected_model = st.sidebar.selectbox("Select Model", models)
54
 
55
  temp_values = st.sidebar.slider('Select a temperature value', 0.0, 1.0, (0.5))
56
 
 
 
 
 
 
 
57
  st.sidebar.button('Reset Chat', on_click=reset_conversation)
58
 
59
 
@@ -88,14 +94,12 @@ for message in st.session_state.messages:
88
 
89
  if prompt := st.chat_input(f"Hi I'm {selected_model}, How can I help you today?"):
90
 
91
- custom_instruction = "Act like a Human in conversation, you are helpfull assistant"
92
-
93
  with st.chat_message("user"):
94
  st.markdown(prompt)
95
 
96
  st.session_state.messages.append({"role": "user", "content": prompt})
97
 
98
- formated_text = format_promt(prompt, custom_instruction)
99
 
100
 
101
  with st.chat_message("assistant"):
 
3
  import os
4
  import sys
5
 
6
+ st.title("SmallZOO ChatBot 3B")
7
 
8
  base_url="https://api-inference.huggingface.co/models/"
9
  API_KEY = os.environ.get('HG_Interference_API_TOKEN')
 
54
 
55
  temp_values = st.sidebar.slider('Select a temperature value', 0.0, 1.0, (0.5))
56
 
57
+ custom_instructions = st.sidebar.text_area(
58
+ "Custom Instructions",
59
+ value="Act like a Human in conversation, you are helpful assistant. Keep asnwers short!",
60
+ help="Customize how the AI should behave"
61
+ )
62
+
63
  st.sidebar.button('Reset Chat', on_click=reset_conversation)
64
 
65
 
 
94
 
95
  if prompt := st.chat_input(f"Hi I'm {selected_model}, How can I help you today?"):
96
 
 
 
97
  with st.chat_message("user"):
98
  st.markdown(prompt)
99
 
100
  st.session_state.messages.append({"role": "user", "content": prompt})
101
 
102
+ formated_text = format_promt(prompt, custom_instructions)
103
 
104
 
105
  with st.chat_message("assistant"):