Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,41 +4,48 @@ from pingpong import PingPong
|
|
4 |
from pingpong.gradio import GradioAlpacaChatPPManager
|
5 |
|
6 |
STYLE = """
|
|
|
|
|
|
|
|
|
7 |
.custom-btn {
|
8 |
border: none !important;
|
9 |
background: none !important;
|
10 |
box-shadow: none !important;
|
|
|
|
|
11 |
}
|
12 |
-
|
13 |
.custom-btn:hover {
|
14 |
background: rgb(243 244 246) !important;
|
15 |
}
|
16 |
-
|
17 |
#prompt-txt > label > span {
|
18 |
display: none !important;
|
19 |
}
|
20 |
-
|
21 |
#prompt-txt > label > textarea {
|
22 |
border: transparent;
|
23 |
box-shadow: none;
|
24 |
}
|
25 |
-
|
26 |
#chatbot {
|
27 |
height: 800px;
|
28 |
overflow: auto;
|
29 |
box-shadow: none !important;
|
30 |
border: none !important;
|
31 |
}
|
32 |
-
|
33 |
#chatbot > .wrap {
|
34 |
max-height: 780px;
|
35 |
}
|
36 |
-
|
37 |
#left-pane {
|
38 |
background-color: #f9fafb;
|
39 |
border-radius: 15px;
|
|
|
|
|
|
|
|
|
40 |
padding-left: 10px;
|
41 |
padding-right: 10px;
|
|
|
|
|
|
|
42 |
}
|
43 |
"""
|
44 |
|
@@ -52,9 +59,7 @@ function() {
|
|
52 |
}
|
53 |
const local_data = getStorage('local_data');
|
54 |
const history = [];
|
55 |
-
|
56 |
console.log(1);
|
57 |
-
|
58 |
if(local_data) {
|
59 |
console.log(2);
|
60 |
console.log(local_data);
|
@@ -62,7 +67,6 @@ function() {
|
|
62 |
history.push([element.ping, element.pong])
|
63 |
);
|
64 |
}
|
65 |
-
|
66 |
console.log(history);
|
67 |
return [local_data, history];
|
68 |
}
|
@@ -125,7 +129,7 @@ def initialize_t(ld):
|
|
125 |
|
126 |
return list_conv[0].build_uis(), local_data
|
127 |
|
128 |
-
with gr.Blocks(css=STYLE,
|
129 |
idx = gr.State(0)
|
130 |
ttt = gr.Textbox(visible=False)
|
131 |
local_data = gr.JSON(
|
@@ -135,8 +139,8 @@ with gr.Blocks(css=STYLE, theme='gradio/soft') as block:
|
|
135 |
)
|
136 |
|
137 |
with gr.Row():
|
138 |
-
with gr.Column(scale=1, min_width=
|
139 |
-
gr.Markdown("GradioChat")
|
140 |
|
141 |
with gr.Column(elem_id="left-pane"):
|
142 |
first = gr.Button("1st", elem_classes=["custom-btn"])
|
@@ -145,10 +149,10 @@ with gr.Blocks(css=STYLE, theme='gradio/soft') as block:
|
|
145 |
fourth = gr.Button("4th", elem_classes=["custom-btn"])
|
146 |
fifth = gr.Button("5th", elem_classes=["custom-btn"])
|
147 |
|
148 |
-
with gr.Column(scale=
|
149 |
chatbot = gr.Chatbot(elem_id='chatbot')
|
150 |
instruction_txtbox = gr.Textbox(
|
151 |
-
placeholder="
|
152 |
elem_id="prompt-txt"
|
153 |
)
|
154 |
|
|
|
4 |
from pingpong.gradio import GradioAlpacaChatPPManager
|
5 |
|
6 |
STYLE = """
|
7 |
+
#container-col {
|
8 |
+
|
9 |
+
}
|
10 |
+
|
11 |
.custom-btn {
|
12 |
border: none !important;
|
13 |
background: none !important;
|
14 |
box-shadow: none !important;
|
15 |
+
display: block !important;
|
16 |
+
text-align: left !important;
|
17 |
}
|
|
|
18 |
.custom-btn:hover {
|
19 |
background: rgb(243 244 246) !important;
|
20 |
}
|
|
|
21 |
#prompt-txt > label > span {
|
22 |
display: none !important;
|
23 |
}
|
|
|
24 |
#prompt-txt > label > textarea {
|
25 |
border: transparent;
|
26 |
box-shadow: none;
|
27 |
}
|
|
|
28 |
#chatbot {
|
29 |
height: 800px;
|
30 |
overflow: auto;
|
31 |
box-shadow: none !important;
|
32 |
border: none !important;
|
33 |
}
|
|
|
34 |
#chatbot > .wrap {
|
35 |
max-height: 780px;
|
36 |
}
|
|
|
37 |
#left-pane {
|
38 |
background-color: #f9fafb;
|
39 |
border-radius: 15px;
|
40 |
+
padding: 10px;
|
41 |
+
}
|
42 |
+
|
43 |
+
#left-top {
|
44 |
padding-left: 10px;
|
45 |
padding-right: 10px;
|
46 |
+
text-align: center;
|
47 |
+
font-weight: bold;
|
48 |
+
font-size: large;
|
49 |
}
|
50 |
"""
|
51 |
|
|
|
59 |
}
|
60 |
const local_data = getStorage('local_data');
|
61 |
const history = [];
|
|
|
62 |
console.log(1);
|
|
|
63 |
if(local_data) {
|
64 |
console.log(2);
|
65 |
console.log(local_data);
|
|
|
67 |
history.push([element.ping, element.pong])
|
68 |
);
|
69 |
}
|
|
|
70 |
console.log(history);
|
71 |
return [local_data, history];
|
72 |
}
|
|
|
129 |
|
130 |
return list_conv[0].build_uis(), local_data
|
131 |
|
132 |
+
with gr.Blocks(css=STYLE, elem_id='container-col') as block:
|
133 |
idx = gr.State(0)
|
134 |
ttt = gr.Textbox(visible=False)
|
135 |
local_data = gr.JSON(
|
|
|
139 |
)
|
140 |
|
141 |
with gr.Row():
|
142 |
+
with gr.Column(scale=1, min_width=180):
|
143 |
+
gr.Markdown("GradioChat", elem_id="left-top")
|
144 |
|
145 |
with gr.Column(elem_id="left-pane"):
|
146 |
first = gr.Button("1st", elem_classes=["custom-btn"])
|
|
|
149 |
fourth = gr.Button("4th", elem_classes=["custom-btn"])
|
150 |
fifth = gr.Button("5th", elem_classes=["custom-btn"])
|
151 |
|
152 |
+
with gr.Column(scale=8):
|
153 |
chatbot = gr.Chatbot(elem_id='chatbot')
|
154 |
instruction_txtbox = gr.Textbox(
|
155 |
+
placeholder="Ask anything", label="",
|
156 |
elem_id="prompt-txt"
|
157 |
)
|
158 |
|