Spaces:
Running
on
Zero
Running
on
Zero
MaziyarPanahi
commited on
Commit
•
bec5a84
1
Parent(s):
8ce485a
Update app.py (#6)
Browse files- Update app.py (2635d75282df66ba00ee31ae270e6cffb1dd11ce)
app.py
CHANGED
@@ -39,8 +39,8 @@ def bot_streaming(message, history):
|
|
39 |
gr.Error("You need to upload an image for LLaVA to work.")
|
40 |
prompt=f"<|start_header_id|>user<|end_header_id|>\n\n<image>\n{message['text']}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
|
41 |
print(f"prompt: {prompt}")
|
42 |
-
image = Image.open(
|
43 |
-
inputs = processor(prompt,
|
44 |
|
45 |
streamer = TextIteratorStreamer(processor, **{"skip_special_tokens": True})
|
46 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=200)
|
|
|
39 |
gr.Error("You need to upload an image for LLaVA to work.")
|
40 |
prompt=f"<|start_header_id|>user<|end_header_id|>\n\n<image>\n{message['text']}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
|
41 |
print(f"prompt: {prompt}")
|
42 |
+
image = Image.open(image)
|
43 |
+
inputs = processor(prompt, image, return_tensors='pt').to(0, torch.float16)
|
44 |
|
45 |
streamer = TextIteratorStreamer(processor, **{"skip_special_tokens": True})
|
46 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=200)
|