Spaces:
Sleeping
Sleeping
howard-hou
commited on
Commit
•
9086e70
1
Parent(s):
7758cb9
Update app.py
Browse files
app.py
CHANGED
@@ -104,6 +104,8 @@ examples = [
|
|
104 |
def test(image, question):
|
105 |
image = image_processor(images=image.convert('RGB'), return_tensors='pt')['pixel_values']
|
106 |
image_features = visual_encoder.encode_images(image.unsqueeze(0))
|
|
|
|
|
107 |
image_ids = [i for i in range(emb_mixer.image_start_index, emb_mixer.image_start_index + len(image_features))]
|
108 |
input_text = generate_prompt(question)
|
109 |
for output in generate(input_text, image_ids):
|
@@ -117,4 +119,4 @@ demo = gr.Interface(fn=test,
|
|
117 |
description="VisualRWKV-v5.0")
|
118 |
|
119 |
demo.queue(concurrency_count=1, max_size=10)
|
120 |
-
demo.launch(share=False)
|
|
|
104 |
def test(image, question):
|
105 |
image = image_processor(images=image.convert('RGB'), return_tensors='pt')['pixel_values']
|
106 |
image_features = visual_encoder.encode_images(image.unsqueeze(0))
|
107 |
+
emb_mixer.set_image_embeddings(image_features)
|
108 |
+
model.w["emb.weight"] = emb_mixer.get_input_embeddings()
|
109 |
image_ids = [i for i in range(emb_mixer.image_start_index, emb_mixer.image_start_index + len(image_features))]
|
110 |
input_text = generate_prompt(question)
|
111 |
for output in generate(input_text, image_ids):
|
|
|
119 |
description="VisualRWKV-v5.0")
|
120 |
|
121 |
demo.queue(concurrency_count=1, max_size=10)
|
122 |
+
demo.launch(share=False, enable_queue=True)
|