shogi880 commited on
Commit
b9d582e
1 Parent(s): 3f55b8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -5
app.py CHANGED
@@ -11,13 +11,39 @@ def chatgpt(query):
11
  output = "Please try: https://chat.openai.com"
12
  return output
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  with gr.Blocks() as demo:
15
- gr.Markdown("Start typing below and then click **Run** to see the output.")
 
 
 
 
 
 
 
 
 
 
 
16
  with gr.Row():
17
- inp = gr.Dropdown(["a playful man", "a trusing woman", "a boy who is bullied"])
18
- out = gr.Textbox()
19
- btn = gr.Button("Ask ChatGPT to generate a detailed description.")
20
- btn.click(fn=chatgpt, inputs=inp, outputs=out)
 
21
 
22
 
23
  demo.launch()
 
11
  output = "Please try: https://chat.openai.com"
12
  return output
13
 
14
+ def generateimage1(query):
15
+ try:
16
+ output = dictionary[query]
17
+ except:
18
+ output = "Please try: https://chat.openai.com"
19
+ return output
20
+
21
+ def generateimage2(query):
22
+ try:
23
+ output = dictionary[query]
24
+ except:
25
+ output = "Please try: https://chat.openai.com"
26
+ return output
27
+
28
  with gr.Blocks() as demo:
29
+ gr.Markdown("Ask ChatGPT to generate detailed descriptbions.")
30
+ with gr.Row():
31
+ inpprompt = gr.Dropdown(["a playful man", "a trusing woman", "a boy who is bullied"])
32
+ outprompt = gr.Textbox()
33
+ btn = gr.Button("Generate mode detailed description.")
34
+ btn.click(fn=chatgpt, inputs=inpprompt, outputs=outprompt)
35
+
36
+
37
+ gr.Markdown("Ask **Stable Diffusion** to generate images.")
38
+ with gr.Row():
39
+ out1image = gr.Image()
40
+ out2image = gr.Image()
41
  with gr.Row():
42
+ btn1 = gr.Button("Generate image with origial prompt.")
43
+ btn2 = gr.Button("Generate image with ChatGPT's prompt.")
44
+
45
+ btn.click(fn=generateimage1, inputs=inpprompt, outputs=out1image)
46
+ btn.click(fn=generateimage2, inputs=outprompt, outputs=out2image)
47
 
48
 
49
  demo.launch()