qianmuuq commited on
Commit
77cac22
1 Parent(s): 4aac714

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -18
main.py CHANGED
@@ -99,7 +99,7 @@ class Word_BERT(nn.Module):
99
  ly_transfer = self.ly_transfer(pool)
100
  return out,cancer,transfer,ly_transfer
101
 
102
- def getChat(text: str, userid: int):
103
  # while True:
104
  # if True:
105
  # text = input("user:")
@@ -180,34 +180,19 @@ model.eval()
180
  Allhistory = {}
181
  print('初始化完成')
182
 
183
- # if __name__ == '__main__':
184
- # # getChat("测试一下", 0)
185
- # # main()
186
- # uvicorn.run(app='main:app', host="localhost",
187
- # port=7860, reload=False)
188
- # # testFunc()
189
-
190
-
191
- class Items1(BaseModel):
192
- context: str
193
- userid: int
194
- # must: bool
195
-
196
-
197
  import time
198
 
199
  lastReplyTime = 0
200
 
201
 
202
  @app.post("/")
203
- async def get_Chat(item1: Items1):
204
  global lastReplyTime
205
  tempReplyTime = int(time.time() * 1000)
206
  # if tempReplyTime % 10 == 0 or item1.must == True or tempReplyTime - lastReplyTime < 30000:
207
  # if item1.must == True:
208
  # lastReplyTime = tempReplyTime
209
- result = getChat(
210
- item1.context, item1.userid)
211
  return {"res": result}
212
 
213
  @app.get("/hello")
 
99
  ly_transfer = self.ly_transfer(pool)
100
  return out,cancer,transfer,ly_transfer
101
 
102
+ def getChat(text):
103
  # while True:
104
  # if True:
105
  # text = input("user:")
 
180
  Allhistory = {}
181
  print('初始化完成')
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  import time
184
 
185
  lastReplyTime = 0
186
 
187
 
188
  @app.post("/")
189
+ async def get_Chat(context):
190
  global lastReplyTime
191
  tempReplyTime = int(time.time() * 1000)
192
  # if tempReplyTime % 10 == 0 or item1.must == True or tempReplyTime - lastReplyTime < 30000:
193
  # if item1.must == True:
194
  # lastReplyTime = tempReplyTime
195
+ result = getChat(context)
 
196
  return {"res": result}
197
 
198
  @app.get("/hello")