Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
with gr.Row():
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
btn.click(fn=
|
|
|
|
| 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()
|