Reyad-Ahmmed commited on
Commit
9d6ef4e
·
verified ·
1 Parent(s): 4065b97

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +5 -1
handler.py CHANGED
@@ -53,7 +53,11 @@ class EndpointHandler:
53
  output_ids = self.model.generate(input_ids, max_length=100, temperature=0.3)
54
 
55
  json_output = self.tokenizer.decode(output_ids[0], skip_special_tokens=True)
56
- return json.loads(json_output)
 
 
 
 
57
 
58
  except Exception as e:
59
  return {"error": f"Unexpected error: {str(e)}"}
 
53
  output_ids = self.model.generate(input_ids, max_length=100, temperature=0.3)
54
 
55
  json_output = self.tokenizer.decode(output_ids[0], skip_special_tokens=True)
56
+ # return json.loads(json_output)
57
+ try:
58
+ return json.loads(json_output)
59
+ except:
60
+ return json_output
61
 
62
  except Exception as e:
63
  return {"error": f"Unexpected error: {str(e)}"}