Spaces:
Runtime error
Runtime error
Commit
·
a93cec5
1
Parent(s):
1b151a6
Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,6 @@ def configure_chatgpt(info):
|
|
40 |
global chatgpt
|
41 |
chatgpt = Chatbot(config=config)
|
42 |
|
43 |
-
# Call initialize prompt on login
|
44 |
-
initialize.click()
|
45 |
-
|
46 |
|
47 |
def ask(prompt):
|
48 |
message = ""
|
@@ -99,10 +96,14 @@ with gr.Blocks() as demo:
|
|
99 |
with gr.Row():
|
100 |
login = gr.Button("Login")
|
101 |
login.click(configure_chatgpt, inputs=[info])
|
102 |
-
|
103 |
|
104 |
l = os.listdir("./prompts")
|
105 |
li = [x.split(".")[0] for x in l]
|
|
|
|
|
|
|
|
|
|
|
106 |
gr.Markdown("""<h4>Conversation</h4>""")
|
107 |
chatgpt_robot = gr.Chatbot()
|
108 |
message = gr.Textbox(
|
@@ -113,9 +114,6 @@ with gr.Blocks() as demo:
|
|
113 |
|
114 |
state = gr.State()
|
115 |
|
116 |
-
# On login click, initialize the prompt, it should be hidden button which will be clicked on login
|
117 |
-
initialize = gr.Button("Initialize")
|
118 |
-
initialize.hidden = True
|
119 |
initialize.click(fn=initialize_prompt, inputs=[state], outputs=[chatgpt_robot, state])
|
120 |
|
121 |
message.submit(query_chatgpt, inputs=[message, state], outputs=[chatgpt_robot, state, message])
|
|
|
40 |
global chatgpt
|
41 |
chatgpt = Chatbot(config=config)
|
42 |
|
|
|
|
|
|
|
43 |
|
44 |
def ask(prompt):
|
45 |
message = ""
|
|
|
96 |
with gr.Row():
|
97 |
login = gr.Button("Login")
|
98 |
login.click(configure_chatgpt, inputs=[info])
|
|
|
99 |
|
100 |
l = os.listdir("./prompts")
|
101 |
li = [x.split(".")[0] for x in l]
|
102 |
+
|
103 |
+
gr.Markdown("""<h4>Initialize ChatGPT</h4>""")
|
104 |
+
|
105 |
+
initialize = gr.Button(value="Initialize")
|
106 |
+
|
107 |
gr.Markdown("""<h4>Conversation</h4>""")
|
108 |
chatgpt_robot = gr.Chatbot()
|
109 |
message = gr.Textbox(
|
|
|
114 |
|
115 |
state = gr.State()
|
116 |
|
|
|
|
|
|
|
117 |
initialize.click(fn=initialize_prompt, inputs=[state], outputs=[chatgpt_robot, state])
|
118 |
|
119 |
message.submit(query_chatgpt, inputs=[message, state], outputs=[chatgpt_robot, state, message])
|