Spaces:
Runtime error
Runtime error
added some tweaks to the UI (#3)
Browse files- added some tweaks to the UI (9dcfe6d5f873e2dfecff844b013d0a4dbdc2f371)
Co-authored-by: yuvraj sharma <ysharma@users.noreply.huggingface.co>
app.py
CHANGED
|
@@ -144,13 +144,13 @@ bot = ConversationBot({'Text2Image':'cuda:0',
|
|
| 144 |
'CannyText2Image':'cuda:0',
|
| 145 |
'InstructPix2Pix':'cuda:0'})
|
| 146 |
|
| 147 |
-
with gr.Blocks(css="#chatbot
|
| 148 |
with gr.Row():
|
| 149 |
gr.Markdown("<h3><center>Visual ChatGPT</center></h3>")
|
| 150 |
|
| 151 |
with gr.Row():
|
| 152 |
openai_api_key_textbox = gr.Textbox(
|
| 153 |
-
placeholder="Paste your OpenAI API key here to start Visual ChatGPT(sk-...)",
|
| 154 |
show_label=False,
|
| 155 |
lines=1,
|
| 156 |
type="password",
|
|
@@ -162,10 +162,12 @@ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
|
| 162 |
with gr.Row(visible=False) as input_raws:
|
| 163 |
with gr.Column(scale=0.7):
|
| 164 |
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter, or upload an image").style(container=False)
|
| 165 |
-
with gr.Column(scale=0.
|
| 166 |
-
|
| 167 |
-
with gr.Column(scale=0.
|
| 168 |
-
|
|
|
|
|
|
|
| 169 |
|
| 170 |
gr.Examples(
|
| 171 |
examples=["Generate a figure of a cat running in the garden",
|
|
@@ -183,9 +185,11 @@ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
|
| 183 |
openai_api_key_textbox.submit(bot.init_agent, [openai_api_key_textbox], [input_raws])
|
| 184 |
txt.submit(bot.run_text, [txt, state], [chatbot, state])
|
| 185 |
txt.submit(lambda: "", None, txt)
|
|
|
|
|
|
|
| 186 |
btn.upload(bot.run_image, [btn, state, txt], [chatbot, state, txt])
|
| 187 |
clear.click(bot.memory.clear)
|
| 188 |
clear.click(lambda: [], None, chatbot)
|
| 189 |
clear.click(lambda: [], None, state)
|
| 190 |
|
| 191 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 144 |
'CannyText2Image':'cuda:0',
|
| 145 |
'InstructPix2Pix':'cuda:0'})
|
| 146 |
|
| 147 |
+
with gr.Blocks(css="#chatbot {overflow:auto; height:500px;}") as demo:
|
| 148 |
with gr.Row():
|
| 149 |
gr.Markdown("<h3><center>Visual ChatGPT</center></h3>")
|
| 150 |
|
| 151 |
with gr.Row():
|
| 152 |
openai_api_key_textbox = gr.Textbox(
|
| 153 |
+
placeholder="Paste your OpenAI API key here to start Visual ChatGPT(sk-...) and press Enter ↵️",
|
| 154 |
show_label=False,
|
| 155 |
lines=1,
|
| 156 |
type="password",
|
|
|
|
| 162 |
with gr.Row(visible=False) as input_raws:
|
| 163 |
with gr.Column(scale=0.7):
|
| 164 |
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter, or upload an image").style(container=False)
|
| 165 |
+
with gr.Column(scale=0.10, min_width=0):
|
| 166 |
+
run = gr.Button("🏃♂️Run")
|
| 167 |
+
with gr.Column(scale=0.10, min_width=0):
|
| 168 |
+
clear = gr.Button("🔄Clear️")
|
| 169 |
+
with gr.Column(scale=0.10, min_width=0):
|
| 170 |
+
btn = gr.UploadButton("🖼️Upload", file_types=["image"])
|
| 171 |
|
| 172 |
gr.Examples(
|
| 173 |
examples=["Generate a figure of a cat running in the garden",
|
|
|
|
| 185 |
openai_api_key_textbox.submit(bot.init_agent, [openai_api_key_textbox], [input_raws])
|
| 186 |
txt.submit(bot.run_text, [txt, state], [chatbot, state])
|
| 187 |
txt.submit(lambda: "", None, txt)
|
| 188 |
+
run.click(bot.run_text, [txt, state], [chatbot, state])
|
| 189 |
+
run.click(lambda: "", None, txt)
|
| 190 |
btn.upload(bot.run_image, [btn, state, txt], [chatbot, state, txt])
|
| 191 |
clear.click(bot.memory.clear)
|
| 192 |
clear.click(lambda: [], None, chatbot)
|
| 193 |
clear.click(lambda: [], None, state)
|
| 194 |
|
| 195 |
+
demo.queue(concurrency_count=10).launch(server_name="0.0.0.0", server_port=7860)
|