Spaces:
Runtime error
Runtime error
LanHarmony
commited on
Commit
•
9a49cde
1
Parent(s):
2afcd2a
api key
Browse files
app.py
CHANGED
@@ -70,7 +70,7 @@ def cut_dialogue_history(history_memory, keep_last_n_words=500):
|
|
70 |
class ConversationBot:
|
71 |
def __init__(self):
|
72 |
print("Initializing VisualChatGPT")
|
73 |
-
self.llm = OpenAI(temperature=0)
|
74 |
self.edit = ImageEditing(device="cuda:0")
|
75 |
self.i2t = ImageCaptioning(device="cuda:0")
|
76 |
self.t2i = T2I(device="cuda:0")
|
@@ -206,9 +206,6 @@ class ConversationBot:
|
|
206 |
print("Outputs:", state)
|
207 |
return state, state, txt + ' ' + image_filename + ' '
|
208 |
|
209 |
-
def change_api_key(self, user_token):
|
210 |
-
self.llm.openai_api_key = user_token
|
211 |
-
|
212 |
bot = ConversationBot()
|
213 |
with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
214 |
with gr.Row():
|
@@ -240,6 +237,6 @@ with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
|
240 |
clear.click(bot.memory.clear)
|
241 |
clear.click(lambda: [], None, chatbot)
|
242 |
clear.click(lambda: [], None, state)
|
243 |
-
|
244 |
|
245 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
70 |
class ConversationBot:
|
71 |
def __init__(self):
|
72 |
print("Initializing VisualChatGPT")
|
73 |
+
self.llm = OpenAI(temperature=0, openai_api_key="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")
|
74 |
self.edit = ImageEditing(device="cuda:0")
|
75 |
self.i2t = ImageCaptioning(device="cuda:0")
|
76 |
self.t2i = T2I(device="cuda:0")
|
|
|
206 |
print("Outputs:", state)
|
207 |
return state, state, txt + ' ' + image_filename + ' '
|
208 |
|
|
|
|
|
|
|
209 |
bot = ConversationBot()
|
210 |
with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
|
211 |
with gr.Row():
|
|
|
237 |
clear.click(bot.memory.clear)
|
238 |
clear.click(lambda: [], None, chatbot)
|
239 |
clear.click(lambda: [], None, state)
|
240 |
+
|
241 |
|
242 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|