Sean Laurent commited on
Commit
d07aad8
·
1 Parent(s): df9b97c

Minor change

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -4,7 +4,7 @@ import os
4
 
5
  openai.api_key = os.environ.get("OPENAI_API_KEY")
6
 
7
- # Dalle API -openai
8
  def open_ai_txt2img(prompt):
9
  response = openai.Image.create(
10
  prompt=prompt,
@@ -14,20 +14,17 @@ def open_ai_txt2img(prompt):
14
  return response["data"][0]["url"]
15
 
16
  # Gradio Interface
17
- # def generator(prompt):
18
- # return open_ai_txt2img(prompt), open_ai_txt2img(prompt), open_ai_txt2img(prompt)
19
-
20
- # with gr.Blocks() as demo:
21
- # prompt = gr.Textbox(label="Prompt")
22
- # submit = gr.Button(label="Generate")
23
- # image1 = gr.Image()
24
- # image2 = gr.Image()
25
- # image3 = gr.Image()
26
 
27
- # submit.click(generator, inputs=[prompt], outputs=[image1, image2, image3], api_name="mmd")
 
 
 
 
 
28
 
29
- def generator(prompt):
30
- return open_ai_txt2img(prompt)
31
 
32
- demo = gr.Interface(fn=generator, inputs="text", outputs="image")
33
  demo.launch()
 
4
 
5
  openai.api_key = os.environ.get("OPENAI_API_KEY")
6
 
7
+ # Dalle API
8
  def open_ai_txt2img(prompt):
9
  response = openai.Image.create(
10
  prompt=prompt,
 
14
  return response["data"][0]["url"]
15
 
16
  # Gradio Interface
17
+ def generator(prompt):
18
+ return open_ai_txt2img(prompt), open_ai_txt2img(prompt), open_ai_txt2img(prompt)
 
 
 
 
 
 
 
19
 
20
+ with gr.Blocks() as demo:
21
+ prompt = gr.Textbox(label="Prompt")
22
+ submit = gr.Button(label="Generate")
23
+ image1 = gr.Image()
24
+ image2 = gr.Image()
25
+ image3 = gr.Image()
26
 
27
+ submit.click(generator, inputs=[prompt], outputs=[image1, image2, image3], api_name="mmd")
 
28
 
29
+ # demo = gr.Interface(fn=generator, inputs="text", outputs="image")
30
  demo.launch()