whan12 commited on
Commit
8b41084
1 Parent(s): 1249fdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -103,8 +103,6 @@ def bot(history, text_input, image, temperature, length_penalty, repetition_pena
103
  yield history + [["Please input image or wait for image to be uploaded before clicking submit.", None]]
104
  return
105
 
106
- chat_history = " ".join([item for sublist in history for item in sublist if item is not None]) # Flatten history
107
-
108
  if arnold_mode:
109
  system_prompt = """You are Arnold Schwarzenegger, the famous bodybuilder, actor, and former Mr. Olympia.
110
  Respond in his iconic style, using his catchphrases and focusing on fitness, bodybuilding, and motivation.
@@ -112,7 +110,8 @@ def bot(history, text_input, image, temperature, length_penalty, repetition_pena
112
  else:
113
  system_prompt = "You are a helpful AI assistant. Provide clear and concise responses to the user's questions about the image and text input."
114
 
115
- prompt = f"{system_prompt}\n{chat_history}\nUSER: <image>\n{text_input}\nASSISTANT:"
 
116
 
117
  response = infer(image, prompt, temperature, length_penalty, repetition_penalty, max_length, min_length, top_p)
118
 
@@ -124,7 +123,7 @@ def bot(history, text_input, image, temperature, length_penalty, repetition_pena
124
  history[-1][1] = response[:i+1]
125
  time.sleep(0.05)
126
  yield history
127
-
128
  with gr.Blocks() as demo:
129
  gr.Markdown(DESCRIPTION)
130
  gr.Markdown("""## LLaVA, one of the greatest multimodal chat models is now available in Transformers with 4-bit quantization! ⚡️
 
103
  yield history + [["Please input image or wait for image to be uploaded before clicking submit.", None]]
104
  return
105
 
 
 
106
  if arnold_mode:
107
  system_prompt = """You are Arnold Schwarzenegger, the famous bodybuilder, actor, and former Mr. Olympia.
108
  Respond in his iconic style, using his catchphrases and focusing on fitness, bodybuilding, and motivation.
 
110
  else:
111
  system_prompt = "You are a helpful AI assistant. Provide clear and concise responses to the user's questions about the image and text input."
112
 
113
+ # Use only the current input for generating the response
114
+ prompt = f"{system_prompt}\nUSER: <image>\n{text_input}\nASSISTANT:"
115
 
116
  response = infer(image, prompt, temperature, length_penalty, repetition_penalty, max_length, min_length, top_p)
117
 
 
123
  history[-1][1] = response[:i+1]
124
  time.sleep(0.05)
125
  yield history
126
+
127
  with gr.Blocks() as demo:
128
  gr.Markdown(DESCRIPTION)
129
  gr.Markdown("""## LLaVA, one of the greatest multimodal chat models is now available in Transformers with 4-bit quantization! ⚡️