a b/scripts/01.chatgpt_api_app_example.py
1
import streamlit as st
2
import openai
3
4
5
openai.api_key = YOUR_API_KEY
6
7
st.set_page_config(page_title="Chat GPT API EXAMPLE", page_icon=":tada:", layout="wide")
8
9
st.subheader(
10
    """
11
                This is Test Landing Page
12
             """
13
)
14
st.title("EXAMPLE")
15
16
title = st.text_input("YOU:")
17
response = openai.Completion.create(
18
    model="text-davinci-003",
19
    prompt=title,
20
    temperature=0,
21
    max_tokens=60,
22
    top_p=1,
23
    frequency_penalty=0.5,
24
    presence_penalty=0,
25
)
26
if st.button("Send"):
27
    st.success(response.choices[0].text)