Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,13 +3,13 @@ import requests
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
st.title("OpenAI Chatbot")
|
| 6 |
-
st.write("Interact with OpenAI's GPT-3 models in real-time using your OpenAI API. Choose from a selection of their best models, set the temperature and max tokens, and start a conversation. Delete the conversation at any time
|
| 7 |
|
| 8 |
if "history" not in st.session_state:
|
| 9 |
st.session_state.history = []
|
| 10 |
|
| 11 |
st.sidebar.markdown("## Configuration")
|
| 12 |
-
KEY = st.sidebar.text_input("Enter
|
| 13 |
models = ['text-davinci-003', 'text-curie-001', 'text-babbage-001', 'text-ada-001']
|
| 14 |
model = st.sidebar.selectbox("Select a model", models, index=0)
|
| 15 |
|
|
@@ -53,7 +53,7 @@ def generate_answer(prompt):
|
|
| 53 |
else:
|
| 54 |
st.error("An error occurred while processing the API response. If using a model other than text-davinci-003, then lower the Max Tokens.")
|
| 55 |
|
| 56 |
-
prompt = st.text_input("Prompt")
|
| 57 |
if st.button("Submit"):
|
| 58 |
generate_answer(prompt)
|
| 59 |
with st.spinner("Waiting for the response from the bot..."):
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
st.title("OpenAI Chatbot")
|
| 6 |
+
st.write("Interact with OpenAI's GPT-3 models in real-time using your OpenAI API. Choose from a selection of their best models, set the temperature and max tokens, and start a conversation. Delete the conversation at any time to start fresh.")
|
| 7 |
|
| 8 |
if "history" not in st.session_state:
|
| 9 |
st.session_state.history = []
|
| 10 |
|
| 11 |
st.sidebar.markdown("## Configuration")
|
| 12 |
+
KEY = st.sidebar.text_input("Enter Your OpenAI API Key", placeholder="API Key", value="")
|
| 13 |
models = ['text-davinci-003', 'text-curie-001', 'text-babbage-001', 'text-ada-001']
|
| 14 |
model = st.sidebar.selectbox("Select a model", models, index=0)
|
| 15 |
|
|
|
|
| 53 |
else:
|
| 54 |
st.error("An error occurred while processing the API response. If using a model other than text-davinci-003, then lower the Max Tokens.")
|
| 55 |
|
| 56 |
+
prompt = st.text_input("Prompt", placeholder="Prompt Here", value="")
|
| 57 |
if st.button("Submit"):
|
| 58 |
generate_answer(prompt)
|
| 59 |
with st.spinner("Waiting for the response from the bot..."):
|