File size: 457 Bytes
9f79320
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import g4f
import streamlit as st




st.title("LearnGPT")
prompt = st.chat_input("Chat")
with st.chat_message("assistant"):
    st.write("Hello i am LearnGPT,How can I help you?")


if prompt:
    with st.chat_message("user"):
        st.write(prompt)        
    
    with st.chat_message("assistant"):
        response = g4f.ChatCompletion.create(
model=g4f.models.gpt_4,
messages=[{"role": "user", "content": prompt}],
)  
        st.markdown(response)