Kannon commited on
Commit
841a5f3
·
1 Parent(s): f8f8c73

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +28 -3
server.py CHANGED
@@ -70,12 +70,12 @@ args = parser.parse_args()
70
  summarization_model = (
71
  args.summarization_model
72
  if args.summarization_model
73
- else DEFAULT_SUMMARIZATION_MODEL
74
  )
75
  classification_model = (
76
  args.classification_model
77
  if args.classification_model
78
- else DEFAULT_CLASSIFICATION_MODEL
79
  )
80
 
81
  device_string = "cpu"
@@ -300,7 +300,32 @@ def api_summarize():
300
  if "text" not in data or not isinstance(data["text"], str):
301
  abort(400, '"text" is required')
302
 
303
- params = DEFAULT_SUMMARIZE_PARAMS.copy()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
 
305
  if "params" in data and isinstance(data["params"], dict):
306
  params.update(data["params"])
 
70
  summarization_model = (
71
  args.summarization_model
72
  if args.summarization_model
73
+ else "Qiliang/bart-large-cnn-samsum-ChatGPT_v3"
74
  )
75
  classification_model = (
76
  args.classification_model
77
  if args.classification_model
78
+ else "nateraw/bert-base-uncased-emotion"
79
  )
80
 
81
  device_string = "cpu"
 
300
  if "text" not in data or not isinstance(data["text"], str):
301
  abort(400, '"text" is required')
302
 
303
+ params = {
304
+ "temperature": 1.0,
305
+ "repetition_penalty": 1.0,
306
+ "max_length": 500,
307
+ "min_length": 200,
308
+ "length_penalty": 1.5,
309
+ "bad_words": [
310
+ "\n",
311
+ '"',
312
+ "*",
313
+ "[",
314
+ "]",
315
+ "{",
316
+ "}",
317
+ ":",
318
+ "(",
319
+ ")",
320
+ "<",
321
+ ">",
322
+ "Â",
323
+ "The text ends",
324
+ "The story ends",
325
+ "The text is",
326
+ "The story is",
327
+ ],
328
+ }
329
 
330
  if "params" in data and isinstance(data["params"], dict):
331
  params.update(data["params"])