-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinput.py
More file actions
28 lines (23 loc) · 749 Bytes
/
input.py
File metadata and controls
28 lines (23 loc) · 749 Bytes
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
import streamlit as st
def takeInput():
# Title
st.title('Make me an Image')
# Ask for the API key
api_key = st.text_input("Enter your OpenAI API key:", type="password")
# Ask for the model choice
model_choice = st.selectbox(
"Which Dall E model would you like to use? ",
("DALL·E 3", "DALL·E 2"),
index=None,
placeholder="Select DALL·E model",
)
# Display user choice
st.write('You selected:', model_choice)
# Logic if no model is selected
if model_choice == "DALL·E 3":
model_choice = "dall-e-3"
else:
model_choice = "dall-e-2"
# Takes the user prompt
prompt = st.text_input("Enter a prompt:")
return model_choice, prompt, api_key