Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,39 +14,30 @@ def chatgpt(query):
|
|
14 |
return output
|
15 |
|
16 |
def generateimage1(query):
|
17 |
-
|
18 |
-
|
19 |
-
except:
|
20 |
-
output = "Please try: https://chat.openai.com"
|
21 |
-
return output
|
22 |
|
23 |
-
def
|
24 |
-
|
25 |
-
|
26 |
-
except:
|
27 |
-
output = "Please try: https://chat.openai.com"
|
28 |
-
return output
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
gr.Markdown("Ask **ChatGPT** to generate detailed descriptbions.")
|
32 |
gr.Markdown("Example: Act as a professional character designer. Please generate prompts include detail appearance descriptions that related to the personality. Here's your first question: 'a gentle man':")
|
|
|
33 |
with gr.Row():
|
34 |
inpprompt = gr.Dropdown(list(dictionary.keys()))
|
35 |
outprompt = gr.Textbox()
|
36 |
-
btn = gr.Button("Generate mode detailed description.")
|
37 |
-
btn.click(fn=chatgpt, inputs=inpprompt, outputs=outprompt)
|
38 |
|
39 |
-
|
40 |
-
gr.Markdown("Ask **Stable Diffusion** to generate images.")
|
41 |
with gr.Row():
|
42 |
out1image = gr.Image()
|
43 |
out2image = gr.Image()
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
|
52 |
demo.launch()
|
|
|
14 |
return output
|
15 |
|
16 |
def generateimage1(query):
|
17 |
+
image = query.replace(' ', '-') + '.png'
|
18 |
+
return image
|
|
|
|
|
|
|
19 |
|
20 |
+
def generateimage1(query):
|
21 |
+
image = query.replace(' ', '-') + '-chatgpt.png'
|
22 |
+
return image
|
|
|
|
|
|
|
23 |
|
24 |
with gr.Blocks() as demo:
|
25 |
gr.Markdown("Ask **ChatGPT** to generate detailed descriptbions.")
|
26 |
gr.Markdown("Example: Act as a professional character designer. Please generate prompts include detail appearance descriptions that related to the personality. Here's your first question: 'a gentle man':")
|
27 |
+
gr.Markdown("Then ask **Stable Diffusion** to generate images based on ChatGPT prompts.")
|
28 |
with gr.Row():
|
29 |
inpprompt = gr.Dropdown(list(dictionary.keys()))
|
30 |
outprompt = gr.Textbox()
|
|
|
|
|
31 |
|
|
|
|
|
32 |
with gr.Row():
|
33 |
out1image = gr.Image()
|
34 |
out2image = gr.Image()
|
35 |
+
|
36 |
+
btn = gr.Button("Generate mode detailed description.")
|
37 |
+
btn.click(fn=chatgpt, inputs=inpprompt, outputs=outprompt)
|
38 |
+
|
39 |
+
btn.click(fn=generateimage1, inputs=inpprompt, outputs=out1image)
|
40 |
+
btn.click(fn=generateimage2, inputs=outprompt, outputs=out2image)
|
41 |
|
42 |
|
43 |
demo.launch()
|