File size: 486 Bytes
4adde4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st
import ollama

def main():
    st.title("Llama Chatbot")
    
    user_input = st.text_input("You:", "Why is the sky blue?")

    if st.button("Ask"):
        with st.spinner("Thinking..."):
            response = ollama.chat(model='llama2', messages=[{
                'role': 'user',
                'content': user_input,
            }])
        st.success("Llama says:")
        st.write(response['message']['content'])

if __name__ == "__main__":
    main()