rphrp1985 commited on
Commit
b3ce18f
1 Parent(s): 8723370

Update app_dialogue.py

Browse files
Files changed (1) hide show
  1. app_dialogue.py +14 -9
app_dialogue.py CHANGED
@@ -265,6 +265,13 @@ def extract_images_from_msg_list(msg_list):
265
  return all_images
266
 
267
 
 
 
 
 
 
 
 
268
  @spaces.GPU(duration=180)
269
  def model_inference(
270
  user_prompt,
@@ -276,15 +283,13 @@ def model_inference(
276
  repetition_penalty,
277
  top_p,
278
  ):
279
- # print('user _prmt=', user_prompt)
280
- # print('chathostoy= ', chat_history)
281
- # if user_prompt["text"].strip() == "" and not user_prompt["files"]:
282
- # gr.Error("Please input a query and optionally image(s).")
283
-
284
- # if user_prompt["text"].strip() == "" and user_prompt["files"]:
285
- # gr.Error("Please input a text query along the image(s).")
286
- user_prompt= {'text': "What's in the image?", 'files':[]}
287
- chat_history=[]
288
 
289
 
290
  streamer = TextIteratorStreamer(
 
265
  return all_images
266
 
267
 
268
+ import json
269
+
270
+ def str_to_json(str_obj):
271
+ json_obj = json.loads(str_obj)
272
+ return json_obj
273
+
274
+
275
  @spaces.GPU(duration=180)
276
  def model_inference(
277
  user_prompt,
 
283
  repetition_penalty,
284
  top_p,
285
  ):
286
+ json_obj = str_to_json(user_prompt)
287
+ print(json_obj)
288
+
289
+
290
+
291
+ user_prompt= json_obj['prompt'] #{'text': "What's in the image?", 'files':[]}
292
+ chat_history=json_obj['history']
 
 
293
 
294
 
295
  streamer = TextIteratorStreamer(