Spaces:
Build error
Build error
RamAnanth1
commited on
Commit
·
315197f
1
Parent(s):
605c3c2
Update app.py
Browse files
app.py
CHANGED
@@ -416,10 +416,11 @@ class ConversationBot:
|
|
416 |
|
417 |
|
418 |
def init_conversation_bot(api_key):
|
|
|
419 |
bot = ConversationBot(api_key)
|
420 |
-
return
|
421 |
|
422 |
-
|
423 |
#bot = ConversationBot()
|
424 |
with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
425 |
openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
|
@@ -427,7 +428,7 @@ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
|
427 |
|
428 |
chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
|
429 |
state = gr.State([])
|
430 |
-
|
431 |
|
432 |
with gr.Row(visible = False) as input_row:
|
433 |
with gr.Column(scale=0.7):
|
@@ -437,7 +438,7 @@ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
|
437 |
with gr.Column(scale=0.15, min_width=0):
|
438 |
btn = gr.UploadButton("Upload", file_types=["image"])
|
439 |
|
440 |
-
openai_api_key.submit(init_conversation_bot,[openai_api_key],[
|
441 |
txt.submit(bot.run_text, [txt, state], [chatbot, state])
|
442 |
txt.submit(lambda: "", None, txt)
|
443 |
btn.upload(bot.run_image, [btn, state, txt], [chatbot, state, txt])
|
|
|
416 |
|
417 |
|
418 |
def init_conversation_bot(api_key):
|
419 |
+
global bot
|
420 |
bot = ConversationBot(api_key)
|
421 |
+
return gr.update(visible = True)
|
422 |
|
423 |
+
bot = None
|
424 |
#bot = ConversationBot()
|
425 |
with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
426 |
openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
|
|
|
428 |
|
429 |
chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
|
430 |
state = gr.State([])
|
431 |
+
|
432 |
|
433 |
with gr.Row(visible = False) as input_row:
|
434 |
with gr.Column(scale=0.7):
|
|
|
438 |
with gr.Column(scale=0.15, min_width=0):
|
439 |
btn = gr.UploadButton("Upload", file_types=["image"])
|
440 |
|
441 |
+
openai_api_key.submit(init_conversation_bot,[openai_api_key],[input_row])
|
442 |
txt.submit(bot.run_text, [txt, state], [chatbot, state])
|
443 |
txt.submit(lambda: "", None, txt)
|
444 |
btn.upload(bot.run_image, [btn, state, txt], [chatbot, state, txt])
|