jkorstad commited on
Commit
fb08bcf
·
verified ·
1 Parent(s): cda9cd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -33,6 +33,8 @@ def predict(image, text):
33
  inputs = processor(image, input_text, return_tensors="pt").to(model.device)
34
  outputs = model.generate(**inputs, max_new_tokens=250)
35
  response = processor.decode(outputs[0], skip_special_tokens=True)
 
 
36
  return f"\n{response}"
37
 
38
  # Gradio
 
33
  inputs = processor(image, input_text, return_tensors="pt").to(model.device)
34
  outputs = model.generate(**inputs, max_new_tokens=250)
35
  response = processor.decode(outputs[0], skip_special_tokens=True)
36
+ # Split the response at the first occurrence of "assistant" and return only the part after it for a clean output.
37
+ response = response.split("assistant", 1)[1].strip()
38
  return f"\n{response}"
39
 
40
  # Gradio