forked from thestonedape/GPT-3-AI-Behaviour-Cloning-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
49 lines (31 loc) · 1.23 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import openai
import streamlit as st
streamlit_style = """
<style>
@import url('https://fonts.googleapis.com/css2?family=Cutive+Mono&display=swap');
html, body, [class*="css"] {
font-family: 'Cutive Mono', monospace;
}
</style>
"""
st.markdown(streamlit_style, unsafe_allow_html = True)
openai.api_key = st.secrets["SECRET_KEY"]
#text on the bottom position of the page
st.title('The Stoned Ape')
st.caption('Still in development.')
st.caption('Backed by [Inside Labs](https://insidelibrary.weebly.com/)')
st.markdown('This is an experiment of prompt designing by using GPT-3(A Transformer based model), a neural network trained and hosted by OpenAI.')
st.caption('Tips: Try to ask specific detaied questions, like "Who are you?"')
prompt_text = st.text_input(label="Input" , value="Ask me anything!")
response = openai.Completion.create(
engine="davinci-instruct-beta-v3",
max_tokens=500,
prompt="Expand the prompt text in to a detailed philosophical and creative explanation.\n\n {}".format(prompt_text),
temperature=0.8,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
st.text('Output:')
if st.button('Generate'):
st.markdown(response["choices"][0]["text"]*1)