Spaces:
Runtime error
Runtime error
Commit
·
6d2ed05
1
Parent(s):
24edd57
remove the existence of the token slider
Browse files
app.py
CHANGED
|
@@ -26,8 +26,10 @@ processor = PaliGemmaProcessor.from_pretrained(model_id)
|
|
| 26 |
def infer(
|
| 27 |
image: PIL.Image.Image,
|
| 28 |
text: str,
|
| 29 |
-
max_new_tokens: int
|
| 30 |
) -> str:
|
|
|
|
|
|
|
| 31 |
inputs = processor(text=text, images=image, return_tensors="pt").to(device)
|
| 32 |
with torch.inference_mode():
|
| 33 |
generated_ids = model.generate(
|
|
@@ -114,8 +116,8 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 114 |
]
|
| 115 |
chat_btn.click(
|
| 116 |
fn=infer,
|
| 117 |
-
|
| 118 |
-
inputs=chat_inputs + [tokens],
|
| 119 |
outputs=chat_outputs,
|
| 120 |
)
|
| 121 |
|
|
|
|
| 26 |
def infer(
|
| 27 |
image: PIL.Image.Image,
|
| 28 |
text: str,
|
| 29 |
+
# max_new_tokens: int
|
| 30 |
) -> str:
|
| 31 |
+
# set this to hide the slider for a bit.
|
| 32 |
+
max_new_tokens = 20
|
| 33 |
inputs = processor(text=text, images=image, return_tensors="pt").to(device)
|
| 34 |
with torch.inference_mode():
|
| 35 |
generated_ids = model.generate(
|
|
|
|
| 116 |
]
|
| 117 |
chat_btn.click(
|
| 118 |
fn=infer,
|
| 119 |
+
inputs=chat_inputs,
|
| 120 |
+
# inputs=chat_inputs + [tokens],
|
| 121 |
outputs=chat_outputs,
|
| 122 |
)
|
| 123 |
|