ldhldh commited on
Commit
dd9b8ae
1 Parent(s): b30a539

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -55,16 +55,18 @@ def chat(name, text, time):
55
  return "no id"
56
  else:
57
  chat_history.append({"name": name, "text":text, "time":time})
58
- global live_user
59
- for u in live_user.keys():
60
- if u == name:
61
- live_user[u] = 20
62
- else:
63
- live_user[u] -= 1
64
- if live_user[u] < 0:
65
- del live_user[u]
66
  return "ok"
67
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  def get_live_user():
70
  return live_user.keys()
@@ -98,6 +100,12 @@ with gr.Blocks() as demo:
98
  outputs="text",
99
  description="register",
100
  )
 
 
 
 
 
 
101
  gg = gr.Interface(
102
  fn=get_live_user,
103
  inputs=[],
 
55
  return "no id"
56
  else:
57
  chat_history.append({"name": name, "text":text, "time":time})
 
 
 
 
 
 
 
 
58
  return "ok"
59
 
60
+ def get_data(name):
61
+ global live_user
62
+ for u in live_user.keys():
63
+ if u == name:
64
+ live_user[u] = 20
65
+ else:
66
+ live_user[u] -= 1
67
+ if live_user[u] < 0:
68
+ del live_user[u]
69
+ return chat_history
70
 
71
  def get_live_user():
72
  return live_user.keys()
 
100
  outputs="text",
101
  description="register",
102
  )
103
+ dd = gr.Interface(
104
+ fn=get_data,
105
+ inputs=["text"],
106
+ outputs="text",
107
+ description="get_data",
108
+ )
109
  gg = gr.Interface(
110
  fn=get_live_user,
111
  inputs=[],