johann22 commited on
Commit
6ca0772
·
1 Parent(s): 107a597

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -111,6 +111,12 @@ def run_idefics(in_prompt,history,image,model_drop,seed):
111
  do_sample=True,
112
  seed=seed,
113
  )
 
 
 
 
 
 
114
  #content = f'{agent.IDEFICS_PROMPT}' +"\nUser"+ in_prompt +f' ![]({image})'
115
  #send_list.append(agent.IDEFICS_PROMPT)
116
  #send_list.append(prompt)
@@ -118,7 +124,8 @@ def run_idefics(in_prompt,history,image,model_drop,seed):
118
  content = "User: What is in this image?![](https://upload.wikimedia.org/wikipedia/commons/8/86/Id%C3%A9fix.JPG)<end_of_utterance>\nAssistant:"
119
 
120
  print(content)
121
- stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
 
122
  resp = ""
123
  for response in stream:
124
  resp += response.token.text
 
111
  do_sample=True,
112
  seed=seed,
113
  )
114
+
115
+ generation_args = {
116
+ "max_new_tokens": 256,
117
+ "repetition_penalty": 1.0,
118
+ "stop_sequences": ["<end_of_utterance>", "\nUser:"],
119
+ }
120
  #content = f'{agent.IDEFICS_PROMPT}' +"\nUser"+ in_prompt +f' ![]({image})'
121
  #send_list.append(agent.IDEFICS_PROMPT)
122
  #send_list.append(prompt)
 
124
  content = "User: What is in this image?![](https://upload.wikimedia.org/wikipedia/commons/8/86/Id%C3%A9fix.JPG)<end_of_utterance>\nAssistant:"
125
 
126
  print(content)
127
+ stream = client.text_generation(content, **generation_args, stream=True, details=True, return_full_text=False)
128
+ #stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
129
  resp = ""
130
  for response in stream:
131
  resp += response.token.text