Spaces:
Running
on
Zero
Running
on
Zero
Update app_dialogue.py
Browse files- 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 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
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(
|