multimodalart HF staff commited on
Commit
c640c8c
1 Parent(s): f1d76bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -160,8 +160,9 @@ def run_captioning_spaces(images, concept_sentence, *captions):
160
  text_input=None,
161
  api_name="/process_image"
162
  )[0]
163
- print(answer)
164
- answer = answer.replace('"', '\\"').replace("'", '"')
 
165
  print(f"Caption: {answer}")
166
  parsed_answer = json.loads(answer)
167
  caption_text = parsed_answer["<DETAILED_CAPTION>"].replace("The image shows ", "")
 
160
  text_input=None,
161
  api_name="/process_image"
162
  )[0]
163
+
164
+ if(answer.startswith("{'<")):
165
+ answer = answer.replace('"', '\\"').replace("'", '"')
166
  print(f"Caption: {answer}")
167
  parsed_answer = json.loads(answer)
168
  caption_text = parsed_answer["<DETAILED_CAPTION>"].replace("The image shows ", "")