Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,7 +59,6 @@ def bot_streaming(message, history):
|
|
| 59 |
text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
|
| 60 |
input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
|
| 61 |
streamer = TextIteratorStreamer(input_ids, **{"skip_special_tokens": True})
|
| 62 |
-
image = Image.open(image)
|
| 63 |
image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
|
| 64 |
generation_kwargs = dict(inputs, images=image_tensor, streamer=streamer, max_new_tokens=100)
|
| 65 |
generated_text = ""
|
|
|
|
| 59 |
text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
|
| 60 |
input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
|
| 61 |
streamer = TextIteratorStreamer(input_ids, **{"skip_special_tokens": True})
|
|
|
|
| 62 |
image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
|
| 63 |
generation_kwargs = dict(inputs, images=image_tensor, streamer=streamer, max_new_tokens=100)
|
| 64 |
generated_text = ""
|