Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -3,6 +3,9 @@ import os | |
| 3 | 
             
            import streamlit as st
         | 
| 4 | 
             
            import json
         | 
| 5 | 
             
            from bardapi import Bard
         | 
|  | |
|  | |
|  | |
| 6 |  | 
| 7 | 
             
            bardKey = os.environ.get('_BARD_API_KEY')
         | 
| 8 |  | 
| @@ -27,10 +30,14 @@ def bardChat(data): | |
| 27 | 
             
                bard = Bard(token=bardKey, session=session, timeout=30)
         | 
| 28 | 
             
                answer = bard.get_answer(data)['content']
         | 
| 29 | 
             
                print(answer)
         | 
| 30 | 
            -
                
         | 
| 31 | 
            -
             | 
|  | |
|  | |
|  | |
| 32 |  | 
| 33 | 
             
            uinput = st.chat_input("Enter your message")
         | 
| 34 | 
             
            with st.chat_message("assistant"):
         | 
| 35 | 
            -
                 | 
|  | |
| 36 |  | 
|  | |
| 3 | 
             
            import streamlit as st
         | 
| 4 | 
             
            import json
         | 
| 5 | 
             
            from bardapi import Bard
         | 
| 6 | 
            +
            from dotenv import load_dotenv
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            load_dotenv()
         | 
| 9 |  | 
| 10 | 
             
            bardKey = os.environ.get('_BARD_API_KEY')
         | 
| 11 |  | 
|  | |
| 30 | 
             
                bard = Bard(token=bardKey, session=session, timeout=30)
         | 
| 31 | 
             
                answer = bard.get_answer(data)['content']
         | 
| 32 | 
             
                print(answer)
         | 
| 33 | 
            +
                reply = {
         | 
| 34 | 
            +
                    'message':answer,
         | 
| 35 | 
            +
                    'action':'null'
         | 
| 36 | 
            +
                }
         | 
| 37 | 
            +
                return reply
         | 
| 38 |  | 
| 39 | 
             
            uinput = st.chat_input("Enter your message")
         | 
| 40 | 
             
            with st.chat_message("assistant"):
         | 
| 41 | 
            +
                bardanswer = bardChat(uinput)
         | 
| 42 | 
            +
                st.markdown(bardanswer['message'])
         | 
| 43 |  | 
