imthanhlv commited on
Commit
d3dcfd0
1 Parent(s): e1cba3c

fix prompts

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -239,6 +239,10 @@ def inference(img, text, is_translation, prompt=None):
239
  model = model.eval()
240
  device = CUDA(0) if is_gpu else "cpu"
241
  model = model.to(device)
 
 
 
 
242
  if is_translation:
243
  # encode text
244
  if text is None:
@@ -277,7 +281,7 @@ inputs = [
277
  gr.inputs.Image(type="file", label="Image to generate Vietnamese caption", optional=True),
278
  gr.inputs.Textbox(lines=2, placeholder="English sentence for translation"),
279
  gr.inputs.Checkbox(),
280
- gr.inputs.Textbox(lines=1, placeholder="Prompt [Optional]", optional=True)
281
  ]
282
 
283
  gr.Interface(
 
239
  model = model.eval()
240
  device = CUDA(0) if is_gpu else "cpu"
241
  model = model.to(device)
242
+
243
+ promt = prompt.strip()
244
+ if not prompt:
245
+ prompt = None
246
  if is_translation:
247
  # encode text
248
  if text is None:
 
281
  gr.inputs.Image(type="file", label="Image to generate Vietnamese caption", optional=True),
282
  gr.inputs.Textbox(lines=2, placeholder="English sentence for translation"),
283
  gr.inputs.Checkbox(),
284
+ gr.inputs.Textbox(lines=1, placeholder="Prompt [Optional]")
285
  ]
286
 
287
  gr.Interface(