vilarin commited on
Commit
ac56402
1 Parent(s): c3e970b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -15,7 +15,7 @@ MODEL_NAME = MODEL_ID.split("/")[-1]
15
 
16
  TITLE = "<h1>VL-Chatbox</h1>"
17
 
18
- DESCRIPTION = f'<p>A SPACE FOR VLM MODELS</p><br><h3><center>MODEL NOW: <a href="https://hf.co/{MODEL_ID}">{MODEL_NAME}</a></center></h3>'
19
 
20
  CSS = """
21
  .duplicate-button {
@@ -28,9 +28,6 @@ h1 {
28
  text-align: center;
29
  display: block;
30
  }
31
- p {
32
- text-align: center;
33
- }
34
  """
35
 
36
  model = AutoModelForCausalLM.from_pretrained(
@@ -57,9 +54,10 @@ def stream_chat(message, history: list, temperature: float, max_length: int, top
57
  image = None
58
  conversation.append({"role": "user", "content": message['text']})
59
  else:
60
- image = Image.open(history[0][0][0])
61
  for prompt, answer in history:
62
  if answer is None:
 
63
  conversation.extend([{"role": "user", "content": ""},{"role": "assistant", "content": ""}])
64
  else:
65
  conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
@@ -96,7 +94,7 @@ chatbot = gr.Chatbot(height=450)
96
  chat_input = gr.MultimodalTextbox(
97
  interactive=True,
98
  file_types=["image"],
99
- placeholder="Enter message or upload file...",
100
  show_label=False,
101
 
102
  )
 
15
 
16
  TITLE = "<h1>VL-Chatbox</h1>"
17
 
18
+ DESCRIPTION = f'<center><p>A SPACE FOR VLM MODELS</p><br><h3>MODEL NOW: <a href="https://hf.co/{MODEL_ID}">{MODEL_NAME}</a></center></h3>'
19
 
20
  CSS = """
21
  .duplicate-button {
 
28
  text-align: center;
29
  display: block;
30
  }
 
 
 
31
  """
32
 
33
  model = AutoModelForCausalLM.from_pretrained(
 
54
  image = None
55
  conversation.append({"role": "user", "content": message['text']})
56
  else:
57
+ #image = Image.open(history[0][0][0])
58
  for prompt, answer in history:
59
  if answer is None:
60
+ image = Image.open(prompt[0])
61
  conversation.extend([{"role": "user", "content": ""},{"role": "assistant", "content": ""}])
62
  else:
63
  conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
 
94
  chat_input = gr.MultimodalTextbox(
95
  interactive=True,
96
  file_types=["image"],
97
+ placeholder="Enter message or upload a file one time...",
98
  show_label=False,
99
 
100
  )