chansung commited on
Commit
d4b2d90
·
1 Parent(s): e5fadbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -22
app.py CHANGED
@@ -4,27 +4,30 @@ from pingpong import PingPong
4
  from pingpong.gradio import GradioAlpacaChatPPManager
5
 
6
  get_local_storage = """
7
- function() {
8
- globalThis.setStorage = (key, value)=>{
9
- localStorage.setItem(key, JSON.stringify(value))
10
- }
11
- globalThis.getStorage = (key, value)=>{
12
- return JSON.parse(localStorage.getItem(key))
13
- }
14
- const local_data = getStorage('local_data')
15
- const history = []
16
-
17
- if(local_data !== undefinfed) {
18
- local_data[0].pingpongs.forEach(element =>
19
- history.push([element.ping, element.pong])
20
- )
21
- }
22
-
23
- console.log(history)
24
-
25
- return [local_data, history];
26
- }
27
- """
 
 
 
28
 
29
  def add_pingpong(idx, ld, ping):
30
  res = [
@@ -173,4 +176,4 @@ with gr.Blocks() as block:
173
  _js=get_local_storage,
174
  )
175
 
176
- block.launch(debug=True)
 
4
  from pingpong.gradio import GradioAlpacaChatPPManager
5
 
6
  get_local_storage = """
7
+ function() {
8
+ globalThis.setStorage = (key, value)=>{
9
+ localStorage.setItem(key, JSON.stringify(value));
10
+ }
11
+ globalThis.getStorage = (key, value)=>{
12
+ return JSON.parse(localStorage.getItem(key));
13
+ }
14
+ const local_data = getStorage('local_data');
15
+ const history = [];
16
+
17
+ console.log(1);
18
+
19
+ if(local_data) {
20
+ console.log(2);
21
+ console.log(local_data);
22
+ local_data[0].pingpongs.forEach(element =>
23
+ history.push([element.ping, element.pong])
24
+ );
25
+ }
26
+
27
+ console.log(history);
28
+ return [local_data, history];
29
+ }
30
+ """
31
 
32
  def add_pingpong(idx, ld, ping):
33
  res = [
 
176
  _js=get_local_storage,
177
  )
178
 
179
+ block.queue().launch(debug=True)