Spaces:
Runtime error
Runtime error
Commit
·
2d038eb
1
Parent(s):
592b027
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
|
|
| 4 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
|
| 5 |
import gradio as gr
|
| 6 |
from transformers import AutoModelForCausalLM, AutoTokenizer, CLIPSegProcessor, CLIPSegForImageSegmentation
|
| 7 |
import torch
|
| 8 |
from diffusers import StableDiffusionPipeline
|
| 9 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
| 10 |
-
import os
|
| 11 |
from langchain.agents.initialize import initialize_agent
|
| 12 |
from langchain.agents.tools import Tool
|
| 13 |
from langchain.chains.conversation.memory import ConversationBufferMemory
|
|
@@ -427,12 +427,13 @@ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
|
| 427 |
chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
|
| 428 |
state = gr.State([])
|
| 429 |
|
| 430 |
-
with gr.
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
|
|
|
| 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])
|
|
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
| 4 |
+
os.mkdir('image')
|
| 5 |
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
|
| 6 |
import gradio as gr
|
| 7 |
from transformers import AutoModelForCausalLM, AutoTokenizer, CLIPSegProcessor, CLIPSegForImageSegmentation
|
| 8 |
import torch
|
| 9 |
from diffusers import StableDiffusionPipeline
|
| 10 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
|
|
|
| 11 |
from langchain.agents.initialize import initialize_agent
|
| 12 |
from langchain.agents.tools import Tool
|
| 13 |
from langchain.chains.conversation.memory import ConversationBufferMemory
|
|
|
|
| 427 |
chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
|
| 428 |
state = gr.State([])
|
| 429 |
|
| 430 |
+
with gr.Row():
|
| 431 |
+
with gr.Column(scale=0.7):
|
| 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])
|