vraman54 commited on
Commit
361624c
1 Parent(s): b362f9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -23
app.py CHANGED
@@ -1,28 +1,31 @@
1
  import os
2
  from embedchain import App
3
  import streamlit as st
 
4
 
5
- with st.sidebar:
6
- huggingface_access_token = st.text_input("Hugging face Token", key="chatbot_api_key", type="password")
7
- "[Get Hugging Face Access Token](https://huggingface.co/settings/tokens)"
8
- "[View the source code](https://github.com/embedchain/examples/mistral-streamlit)"
9
 
10
 
11
- config = {
12
- 'llm': {
13
- 'provider': 'huggingface',
14
- 'config': {
15
- 'model': 'mistralai/Mistral-7B-Instruct-v0.2',
16
- 'top_p': 0.5
17
- }
18
- },
19
- 'embedder': {
20
- 'provider': 'huggingface',
21
- 'config': {
22
- 'model': 'sentence-transformers/all-mpnet-base-v2'
 
 
 
23
  }
24
- }
25
- }
26
 
27
 
28
  st.title("💬 Chatbot")
@@ -43,12 +46,12 @@ for message in st.session_state.messages:
43
  with st.chat_message(message["role"]):
44
  st.markdown(message["content"])
45
 
46
- if prompt := st.chat_input("Ask me anything!"):
47
- if not st.session_state.chatbot_api_key:
48
- st.error("Please enter your Hugging Face Access Token")
49
- st.stop()
50
 
51
- os.environ["HUGGINGFACE_ACCESS_TOKEN"] = st.session_state.chatbot_api_key
52
  app = App.from_config(config = config)
53
  app.add("https://en.wikipedia.org/wiki/Indian_Premier_League")
54
 
 
1
  import os
2
  from embedchain import App
3
  import streamlit as st
4
+ import ollama
5
 
6
+ #with st.sidebar:
7
+ #huggingface_access_token = st.text_input("Hugging face Token", key="chatbot_api_key", type="password")
8
+ #"[Get Hugging Face Access Token](https://huggingface.co/settings/tokens)"
9
+ #"[View the source code](https://github.com/embedchain/examples/mistral-streamlit)"
10
 
11
 
12
+ app = App.from_config(config={
13
+ "llm": {
14
+ "provider": "ollama",
15
+ "config": {
16
+ "model": "llama2",
17
+ "temperature": 0.5,
18
+ "top_p": 1,
19
+ "stream": True
20
+ }
21
+ },
22
+ "embedder": {
23
+ "provider": "huggingface",
24
+ "config": {
25
+ "model": "BAAI/bge-small-en-v1.5"
26
+ }
27
  }
28
+ })
 
29
 
30
 
31
  st.title("💬 Chatbot")
 
46
  with st.chat_message(message["role"]):
47
  st.markdown(message["content"])
48
 
49
+ #if prompt := st.chat_input("Ask me anything!"):
50
+ # if not st.session_state.chatbot_api_key:
51
+ # st.error("Please enter your Hugging Face Access Token")
52
+ # st.stop()
53
 
54
+ # os.environ["HUGGINGFACE_ACCESS_TOKEN"] = st.session_state.chatbot_api_key
55
  app = App.from_config(config = config)
56
  app.add("https://en.wikipedia.org/wiki/Indian_Premier_League")
57