Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
with gr.Blocks() as demo:
|
5 |
overview = gr.Markdown("""
|
6 |
# CentaurSock
|
@@ -12,27 +17,31 @@ with gr.Blocks() as demo:
|
|
12 |
---
|
13 |
""")
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
with gr.Row():
|
16 |
ally_title = gr.Markdown("""<center><h2> ALLY </h2></center>""")
|
17 |
gatekeeper_title = gr.Markdown("""<center><h2> GATEKEEPER </h2></center>""")
|
18 |
-
|
|
|
19 |
with gr.Row():
|
20 |
img1 = gr.Markdown("""![](https://cdn.discordapp.com/attachments/1120417968032063538/1187877117548036147/COP_MIKE.png?ex=65987bc6&is=658606c6&hm=127721b6f907a8853b7352b6bfb821a37b26b9543f3c35e5fc80dfe7750d71b5&)""")
|
21 |
img2 = gr.Markdown("""![](https://cdn.discordapp.com/attachments/1120417968032063538/1187877134866333747/SAM_COP_FINAL.png?ex=65987bca&is=658606ca&hm=6c2cd8059636960134f75962eeecc26a0d875ca65e9ee4e233587cff71af31c4&)""")
|
22 |
|
|
|
23 |
with gr.Row():
|
24 |
chatbot1 = gr.Chatbot(label='Ally Chat')
|
25 |
chatbot2 = gr.Chatbot(label='Gatekeeper Chat')
|
26 |
|
|
|
27 |
with gr.Row():
|
28 |
textbox1 = gr.Textbox(label='Ally')
|
29 |
textbox2 = gr.Textbox(label='Gatekeeper')
|
30 |
|
31 |
-
|
32 |
-
bot_message = 'echo ' + message
|
33 |
-
chat_history.append((message, bot_message))
|
34 |
-
return '', chat_history
|
35 |
-
|
36 |
textbox1.submit(echo, [textbox1, chatbot1], [textbox1, chatbot1])
|
37 |
textbox2.submit(echo, [textbox2, chatbot2], [textbox2, chatbot2])
|
38 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
+
def echo(message, chat_history):
|
5 |
+
bot_message = 'echo ' + message
|
6 |
+
chat_history.append((message, bot_message))
|
7 |
+
return '', chat_history
|
8 |
+
|
9 |
with gr.Blocks() as demo:
|
10 |
overview = gr.Markdown("""
|
11 |
# CentaurSock
|
|
|
17 |
---
|
18 |
""")
|
19 |
|
20 |
+
# OpenAI key
|
21 |
+
openai_key_textbox = gr.Textbox(label='OpenAI Key')
|
22 |
+
openai_key_button = gr.Textbox(label='Test OpenAI Key')
|
23 |
+
|
24 |
+
# Titles
|
25 |
with gr.Row():
|
26 |
ally_title = gr.Markdown("""<center><h2> ALLY </h2></center>""")
|
27 |
gatekeeper_title = gr.Markdown("""<center><h2> GATEKEEPER </h2></center>""")
|
28 |
+
|
29 |
+
# Images of ally and gatekeeper
|
30 |
with gr.Row():
|
31 |
img1 = gr.Markdown("""![](https://cdn.discordapp.com/attachments/1120417968032063538/1187877117548036147/COP_MIKE.png?ex=65987bc6&is=658606c6&hm=127721b6f907a8853b7352b6bfb821a37b26b9543f3c35e5fc80dfe7750d71b5&)""")
|
32 |
img2 = gr.Markdown("""![](https://cdn.discordapp.com/attachments/1120417968032063538/1187877134866333747/SAM_COP_FINAL.png?ex=65987bca&is=658606ca&hm=6c2cd8059636960134f75962eeecc26a0d875ca65e9ee4e233587cff71af31c4&)""")
|
33 |
|
34 |
+
# Chatbots
|
35 |
with gr.Row():
|
36 |
chatbot1 = gr.Chatbot(label='Ally Chat')
|
37 |
chatbot2 = gr.Chatbot(label='Gatekeeper Chat')
|
38 |
|
39 |
+
# Input textboxes
|
40 |
with gr.Row():
|
41 |
textbox1 = gr.Textbox(label='Ally')
|
42 |
textbox2 = gr.Textbox(label='Gatekeeper')
|
43 |
|
44 |
+
# Inpit textbox event handlers
|
|
|
|
|
|
|
|
|
45 |
textbox1.submit(echo, [textbox1, chatbot1], [textbox1, chatbot1])
|
46 |
textbox2.submit(echo, [textbox2, chatbot2], [textbox2, chatbot2])
|
47 |
|