ahmedheakl commited on
Commit
fa08756
·
verified ·
1 Parent(s): 2caebf1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. gradio_app.py +3 -1
gradio_app.py CHANGED
@@ -42,7 +42,7 @@ def load_chat(
42
  role = h.get("role", "")
43
  if isinstance(content, tuple):
44
  src_path = content[0]
45
- hist.append({"role": role, "content": [{"type": "image_url", "image_url": {"url": get_gradio_url(content[0])}}]})
46
  else:
47
  hist.append({"role": role, "content": [{"type": "text", "text": content}]})
48
  history = hist
@@ -53,6 +53,8 @@ def load_chat(
53
  if files:
54
  src_path = files[0]
55
  content.append({"type": "image_url", "image_url": {"url": get_gradio_url(src_path)}})
 
 
56
  stream = client.chat.completions.create(
57
  model=model,
58
  messages=history + [{"role": "user", "content": content}],
 
42
  role = h.get("role", "")
43
  if isinstance(content, tuple):
44
  src_path = content[0]
45
+ hist.append({"role": role, "content": [{"type": "image_url", "image_url": {"url": get_gradio_url(src_path)}}]})
46
  else:
47
  hist.append({"role": role, "content": [{"type": "text", "text": content}]})
48
  history = hist
 
53
  if files:
54
  src_path = files[0]
55
  content.append({"type": "image_url", "image_url": {"url": get_gradio_url(src_path)}})
56
+ messages = history + [{"role": "user", "content": content}]
57
+ print(messages)
58
  stream = client.chat.completions.create(
59
  model=model,
60
  messages=history + [{"role": "user", "content": content}],