nikravan commited on
Commit
1da3a52
·
verified ·
1 Parent(s): caafc4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -36,7 +36,8 @@ def generate_response(message, history):
36
  inputs["token_type_ids"] = torch.ones_like(inputs["input_ids"])
37
 
38
  with torch.no_grad():
39
- text = model.generate(**inputs, max_new_tokens=256, do_sample=False)
 
40
  start = full_output.find('<|object_ref_end|>') + len('<|object_ref_end|>')
41
  end = full_output.find('<|box_end|>')
42
  if end == -1: # اگر <|box_end|> پیدا نشد
@@ -48,7 +49,7 @@ chatbot = gr.ChatInterface(
48
  fn=generate_response,
49
  title="Simple ZeroGPU Chatbot",
50
  description="A simple chatbot using HRM-Text for test, running on Hugging Face ZeroGPU. use only one question in any round",
51
- examples=["Explain why the sky is blue?", "Introduce yourself", "What's the latest news?"]
52
  )
53
 
54
  if __name__ == "__main__":
 
36
  inputs["token_type_ids"] = torch.ones_like(inputs["input_ids"])
37
 
38
  with torch.no_grad():
39
+ out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
40
+ full_output = tokenizer.decode(out[0], skip_special_tokens=False)
41
  start = full_output.find('<|object_ref_end|>') + len('<|object_ref_end|>')
42
  end = full_output.find('<|box_end|>')
43
  if end == -1: # اگر <|box_end|> پیدا نشد
 
49
  fn=generate_response,
50
  title="Simple ZeroGPU Chatbot",
51
  description="A simple chatbot using HRM-Text for test, running on Hugging Face ZeroGPU. use only one question in any round",
52
+ examples=["Explain why the sky is blue?", "Introduce yourself.", "What's the latest news?"]
53
  )
54
 
55
  if __name__ == "__main__":