Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -144,6 +144,7 @@ tokenizer = AutoTokenizer.from_pretrained("khang119966/Vintern-1B-v3_5-explainab
|
|
| 144 |
|
| 145 |
@spaces.GPU
|
| 146 |
def generate_video(image, prompt, max_tokens):
|
|
|
|
| 147 |
pixel_values, target_aspect_ratio = load_image(image, max_num=6).to(torch.bfloat16).cuda()
|
| 148 |
generation_config = dict(max_new_tokens= int(max_tokens), do_sample=False, num_beams = 3, repetition_penalty=2.5)
|
| 149 |
response, query = model.chat(tokenizer, pixel_values, '<image>\n'+prompt, generation_config, return_history=False, \
|
|
@@ -156,9 +157,9 @@ with gr.Blocks() as demo:
|
|
| 156 |
|
| 157 |
with gr.Row():
|
| 158 |
with gr.Column():
|
| 159 |
-
image = gr.Image(label="Upload your image"
|
| 160 |
-
prompt = gr.Textbox(label="Describe your prompt")
|
| 161 |
-
max_tokens = gr.Slider(label="Max token output (⚠️ Choose <100 for faster response)", minimum=1, maximum=512, value=
|
| 162 |
btn = gr.Button("Attenion Video")
|
| 163 |
video = gr.Video(label="Attenion Video")
|
| 164 |
|
|
|
|
| 144 |
|
| 145 |
@spaces.GPU
|
| 146 |
def generate_video(image, prompt, max_tokens):
|
| 147 |
+
print(image)
|
| 148 |
pixel_values, target_aspect_ratio = load_image(image, max_num=6).to(torch.bfloat16).cuda()
|
| 149 |
generation_config = dict(max_new_tokens= int(max_tokens), do_sample=False, num_beams = 3, repetition_penalty=2.5)
|
| 150 |
response, query = model.chat(tokenizer, pixel_values, '<image>\n'+prompt, generation_config, return_history=False, \
|
|
|
|
| 157 |
|
| 158 |
with gr.Row():
|
| 159 |
with gr.Column():
|
| 160 |
+
image = gr.Image(label="Upload your image")
|
| 161 |
+
prompt = gr.Textbox(label="Describe your prompt", value="List all the text." )
|
| 162 |
+
max_tokens = gr.Slider(label="Max token output (⚠️ Choose <100 for faster response)", minimum=1, maximum=512, value=50)
|
| 163 |
btn = gr.Button("Attenion Video")
|
| 164 |
video = gr.Video(label="Attenion Video")
|
| 165 |
|