Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,33 +1,15 @@
|
|
1 |
-
import
|
2 |
-
import
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
image_bytes = requests.post(API_URL, headers=headers, json=payload).content
|
18 |
-
image = Image.open(io.BytesIO(image_bytes))
|
19 |
-
return image
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
with gr.Blocks(theme="pseudolab/huggingface-korea-theme") as dalle:
|
25 |
-
with gr.Row():
|
26 |
-
image_output = gr.Image(type="pil", label="Output Image", elem_id="gallery")
|
27 |
-
with gr.Column(elem_id="prompt-container"):
|
28 |
-
text_prompt = gr.Textbox(label="Prompt", placeholder="a cute cat", lines=1)
|
29 |
-
text_button = gr.Button("Generate", variant='primary', elem_id="gen-button")
|
30 |
-
|
31 |
-
text_button.click(query, inputs=text_prompt , outputs=image_output)
|
32 |
-
|
33 |
-
dalle.launch(show_api=False)
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from openai import OpenAI
|
3 |
+
client = OpenAI(api_key = "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")
|
4 |
+
st.title("Dalle - App")
|
5 |
+
response = client.images.generate(
|
6 |
+
model="dall-e-2",
|
7 |
+
prompt="Programmer",
|
8 |
+
size="1024x1024",
|
9 |
+
quality="standard",
|
10 |
+
n=1,
|
11 |
+
)
|
12 |
+
|
13 |
+
image_url = response.data[0].url
|
14 |
+
|
15 |
+
st.markdown(image_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|