qianmuuq commited on
Commit
7648d5b
β€’
1 Parent(s): f3e5320

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -6
main.py CHANGED
@@ -103,7 +103,7 @@ class Word_BERT(nn.Module):
103
  ly_transfer = self.ly_transfer(pool)
104
  return out,cancer,transfer,ly_transfer
105
 
106
- def getChat(text):
107
  # while True:
108
  # if True:
109
  # text = input("user:")
@@ -141,7 +141,7 @@ def getChat(text):
141
  end = i
142
  size_list.append((start,end))
143
  start = end
144
- print(size_list)
145
 
146
  cancer_dict = {'θ…Ίη™Œ': 0, '肺良性疾病': 1, 'ι³žη™Œ': 2, 'ζ— ζ³•εˆ€ζ–­η»„η»‡εˆ†εž‹': 3, 'ε€εˆεž‹': 4, 'θ½¬η§»η™Œ': 5, 'ε°η»†θƒžη™Œ': 6, 'ε€§η»†θƒžη™Œ': 7}
147
  id_cancer = {j:i for i,j in cancer_dict.items()}
@@ -175,13 +175,13 @@ def model_init():
175
  return model
176
  # return None
177
 
178
- model11 = model_init()
179
- print(os.getcwd())
180
 
181
  @app.get("/infer_t5")
182
  def t5(input):
183
- output = pipe_flan(input)
184
- return {"output": output[0]["generated_text"]}
 
185
 
186
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
187
 
 
103
  ly_transfer = self.ly_transfer(pool)
104
  return out,cancer,transfer,ly_transfer
105
 
106
+ def getChat(text,model):
107
  # while True:
108
  # if True:
109
  # text = input("user:")
 
141
  end = i
142
  size_list.append((start,end))
143
  start = end
144
+ # print(size_list)
145
 
146
  cancer_dict = {'θ…Ίη™Œ': 0, '肺良性疾病': 1, 'ι³žη™Œ': 2, 'ζ— ζ³•εˆ€ζ–­η»„η»‡εˆ†εž‹': 3, 'ε€εˆεž‹': 4, 'θ½¬η§»η™Œ': 5, 'ε°η»†θƒžη™Œ': 6, 'ε€§η»†θƒžη™Œ': 7}
147
  id_cancer = {j:i for i,j in cancer_dict.items()}
 
175
  return model
176
  # return None
177
 
178
+ model_extra = model_init()
 
179
 
180
  @app.get("/infer_t5")
181
  def t5(input):
182
+ r1,r2,r3,r4 = getChat(input,model_extra)
183
+ # output = pipe_flan(input)
184
+ return {"output": r4}
185
 
186
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
187