Spaces:
Runtime error
Runtime error
Commit
·
403777d
1
Parent(s):
2d038eb
Update app.py
Browse files
app.py
CHANGED
@@ -292,7 +292,7 @@ class ConversationBot:
|
|
292 |
def __init__(self):
|
293 |
print("Initializing VisualChatGPT")
|
294 |
#self.edit = ImageEditing(device="cuda:0")
|
295 |
-
|
296 |
self.t2i = T2I(device="cuda:0")
|
297 |
self.image2canny = image2canny()
|
298 |
#self.canny2image = canny2image(device="cuda:0")
|
@@ -300,9 +300,9 @@ class ConversationBot:
|
|
300 |
#self.pix2pix = Pix2Pix(device="cuda:0")
|
301 |
self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
|
302 |
self.tools = [
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
Tool(name="Generate Image From User Input Text", func=self.t2i.inference,
|
307 |
description="useful when you want to generate an image from a user input text and save it to a file. like: generate an image of an object or something, or generate an image that includes some objects. "
|
308 |
"The input to this tool should be a string, representing the text used to generate image. "),
|
@@ -422,18 +422,17 @@ bot = ConversationBot()
|
|
422 |
with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
423 |
openai_api_key_input = gr.Textbox(type = "password", label = "Enter your OpenAI API key here")
|
424 |
|
|
|
|
|
|
|
|
|
425 |
with gr.Row(visible = False) as input_row:
|
426 |
-
with gr.
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
with gr.
|
431 |
-
|
432 |
-
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter, or upload an image").style(container=False)
|
433 |
-
with gr.Column(scale=0.15, min_width=0):
|
434 |
-
clear = gr.Button("Clear️")
|
435 |
-
with gr.Column(scale=0.15, min_width=0):
|
436 |
-
btn = gr.UploadButton("Upload", file_types=["image"])
|
437 |
|
438 |
openai_api_key_input.submit(bot.init_langchain,openai_api_key_input,[input_row])
|
439 |
txt.submit(bot.run_text, [txt, state], [chatbot, state])
|
|
|
292 |
def __init__(self):
|
293 |
print("Initializing VisualChatGPT")
|
294 |
#self.edit = ImageEditing(device="cuda:0")
|
295 |
+
self.i2t = ImageCaptioning(device="cuda:0")
|
296 |
self.t2i = T2I(device="cuda:0")
|
297 |
self.image2canny = image2canny()
|
298 |
#self.canny2image = canny2image(device="cuda:0")
|
|
|
300 |
#self.pix2pix = Pix2Pix(device="cuda:0")
|
301 |
self.memory = ConversationBufferMemory(memory_key="chat_history", output_key='output')
|
302 |
self.tools = [
|
303 |
+
Tool(name="Get Photo Description", func=self.i2t.inference,
|
304 |
+
description="useful when you want to know what is inside the photo. receives image_path as input. "
|
305 |
+
"The input to this tool should be a string, representing the image_path. "),
|
306 |
Tool(name="Generate Image From User Input Text", func=self.t2i.inference,
|
307 |
description="useful when you want to generate an image from a user input text and save it to a file. like: generate an image of an object or something, or generate an image that includes some objects. "
|
308 |
"The input to this tool should be a string, representing the text used to generate image. "),
|
|
|
422 |
with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
423 |
openai_api_key_input = gr.Textbox(type = "password", label = "Enter your OpenAI API key here")
|
424 |
|
425 |
+
|
426 |
+
chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
|
427 |
+
state = gr.State([])
|
428 |
+
|
429 |
with gr.Row(visible = False) as input_row:
|
430 |
+
with gr.Column(scale=0.7):
|
431 |
+
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter, or upload an image").style(container=False)
|
432 |
+
with gr.Column(scale=0.15, min_width=0):
|
433 |
+
clear = gr.Button("Clear️")
|
434 |
+
with gr.Column(scale=0.15, min_width=0):
|
435 |
+
btn = gr.UploadButton("Upload", file_types=["image"])
|
|
|
|
|
|
|
|
|
|
|
436 |
|
437 |
openai_api_key_input.submit(bot.init_langchain,openai_api_key_input,[input_row])
|
438 |
txt.submit(bot.run_text, [txt, state], [chatbot, state])
|