nvinay1803 commited on
Commit
764a615
·
verified ·
1 Parent(s): 54a83d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -61,7 +61,11 @@ class ContentHandler(HuggingFaceEndpoint.ContentHandler):
61
  accepts = "application/json"
62
  len_prompt = 0
63
 
64
-
 
 
 
 
65
  def transform_output(self, output: bytes) -> str:
66
  response_json = output.decode('utf-8')
67
  res = json.loads(response_json)
 
61
  accepts = "application/json"
62
  len_prompt = 0
63
 
64
+ def transform_input(self, prompt: str, model_kwargs: Dict) -> bytes:
65
+ self.len_prompt = len(prompt)
66
+ input_str = json.dumps({"inputs": prompt, "parameters": {"max_new_tokens": 100, "stop": ["Human:"], "do_sample": False, "repetition_penalty": 1.1}})
67
+ return input_str.encode('utf-8')
68
+
69
  def transform_output(self, output: bytes) -> str:
70
  response_json = output.decode('utf-8')
71
  res = json.loads(response_json)