Spaces:
Sleeping
Sleeping
dall-e support
Browse files
app.py
CHANGED
|
@@ -169,6 +169,15 @@ def bot(message, history, oai_key, system_prompt, seed, temperature, max_tokens,
|
|
| 169 |
whisper_prompt += f"\n{human}"
|
| 170 |
if assi is not None:
|
| 171 |
whisper_prompt += f"\n{assi}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
else:
|
| 173 |
seed_i = None
|
| 174 |
if seed:
|
|
@@ -273,7 +282,7 @@ with gr.Blocks(delete_cache=(86400, 86400)) as demo:
|
|
| 273 |
|
| 274 |
oai_key = gr.Textbox(label="OpenAI API Key", elem_id="oai_key")
|
| 275 |
model = gr.Dropdown(label="Model", value="gpt-4-turbo", allow_custom_value=True, elem_id="model",
|
| 276 |
-
choices=["gpt-4-turbo", "gpt-4o-2024-08-06", "chatgpt-4o-latest", "gpt-4o", "gpt-4o-mini", "gpt-4-turbo-preview", "gpt-4-1106-preview", "gpt-4", "gpt-4-vision-preview", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-1106", "whisper"])
|
| 277 |
system_prompt = gr.TextArea("You are a helpful yet diligent AI assistant. Answer faithfully and factually correct. Respond with 'I do not know' if uncertain.", label="System Prompt", lines=3, max_lines=250, elem_id="system_prompt")
|
| 278 |
seed = gr.Textbox(label="Seed", elem_id="seed")
|
| 279 |
temp = gr.Slider(0, 2, label="Temperature", elem_id="temp", value=1)
|
|
|
|
| 169 |
whisper_prompt += f"\n{human}"
|
| 170 |
if assi is not None:
|
| 171 |
whisper_prompt += f"\n{assi}"
|
| 172 |
+
elif model == "dall-e-3":
|
| 173 |
+
response = client.images.generate(
|
| 174 |
+
model=model,
|
| 175 |
+
prompt=message.text,
|
| 176 |
+
size="1792x1024",
|
| 177 |
+
quality="hd",
|
| 178 |
+
n=1,
|
| 179 |
+
)
|
| 180 |
+
yield gr.Image(response.data[0].url)
|
| 181 |
else:
|
| 182 |
seed_i = None
|
| 183 |
if seed:
|
|
|
|
| 282 |
|
| 283 |
oai_key = gr.Textbox(label="OpenAI API Key", elem_id="oai_key")
|
| 284 |
model = gr.Dropdown(label="Model", value="gpt-4-turbo", allow_custom_value=True, elem_id="model",
|
| 285 |
+
choices=["gpt-4-turbo", "gpt-4o-2024-08-06", "chatgpt-4o-latest", "gpt-4o", "gpt-4o-mini", "gpt-4-turbo-preview", "gpt-4-1106-preview", "gpt-4", "gpt-4-vision-preview", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-1106", "whisper", "dall-e-3"])
|
| 286 |
system_prompt = gr.TextArea("You are a helpful yet diligent AI assistant. Answer faithfully and factually correct. Respond with 'I do not know' if uncertain.", label="System Prompt", lines=3, max_lines=250, elem_id="system_prompt")
|
| 287 |
seed = gr.Textbox(label="Seed", elem_id="seed")
|
| 288 |
temp = gr.Slider(0, 2, label="Temperature", elem_id="temp", value=1)
|