multimodalart HF Staff commited on
Commit
bbbb9b2
·
verified ·
1 Parent(s): ed877b6

Simplify content-filter message to 'The classifiers flagged the following'

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -45,8 +45,7 @@ def _blocked_image(reason_text: str, height: int = 1024, width: int = 1024) -> I
45
  font = ImageFont.load_default()
46
 
47
  message = (
48
- "The safety classifiers included by default in the Microsoft Mage "
49
- "Flow model flagged the following:\n\n" + reason_text
50
  )
51
 
52
  # Wrap each paragraph to a column width that fits the image.
@@ -112,7 +111,7 @@ def generate(
112
  verdict = pipe_edit.model.txt_enc.screen_edit(prompt, refs)
113
  if verdict.violates:
114
  reason_text = _block_reason_text(verdict)
115
- gr.Warning(reason_text)
116
  w, h = refs[0].size
117
  return _blocked_image(reason_text, height=h, width=w)
118
 
@@ -133,7 +132,7 @@ def generate(
133
  verdict = pipe_t2i.model.txt_enc.screen_text(prompt)
134
  if verdict.violates:
135
  reason_text = _block_reason_text(verdict)
136
- gr.Warning(reason_text)
137
  return _blocked_image(reason_text, height=int(height), width=int(width))
138
 
139
  img = pipe_t2i.generate(
 
45
  font = ImageFont.load_default()
46
 
47
  message = (
48
+ "The classifiers flagged the following:\n\n" + reason_text
 
49
  )
50
 
51
  # Wrap each paragraph to a column width that fits the image.
 
111
  verdict = pipe_edit.model.txt_enc.screen_edit(prompt, refs)
112
  if verdict.violates:
113
  reason_text = _block_reason_text(verdict)
114
+ gr.Warning("The classifiers flagged the following: " + reason_text)
115
  w, h = refs[0].size
116
  return _blocked_image(reason_text, height=h, width=w)
117
 
 
132
  verdict = pipe_t2i.model.txt_enc.screen_text(prompt)
133
  if verdict.violates:
134
  reason_text = _block_reason_text(verdict)
135
+ gr.Warning("The classifiers flagged the following: " + reason_text)
136
  return _blocked_image(reason_text, height=int(height), width=int(width))
137
 
138
  img = pipe_t2i.generate(