Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ DESCRIPTION = """
|
|
13 |
|
14 |
This is a demo Space for a fine-tuned version of [SmolVLM](https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct) trained using [rlaif-v dataset](https://huggingface.co/datasets/HuggingFaceH4/rlaif-v_formatted).
|
15 |
|
16 |
-
The corresponding model is located [here](https://huggingface.co/
|
17 |
"""
|
18 |
|
19 |
model_id = "HuggingFaceTB/SmolVLM-Instruct"
|
@@ -72,9 +72,15 @@ def run_example(image, text_input=None):
|
|
72 |
text = processor.apply_chat_template(
|
73 |
messages, tokenize=False, add_generation_prompt=True
|
74 |
)
|
75 |
-
image_inputs, video_inputs = process_vision_info(messages)
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
inputs = processor(
|
77 |
-
text=
|
78 |
images=image_inputs,
|
79 |
videos=video_inputs,
|
80 |
padding=True,
|
@@ -103,7 +109,7 @@ css = """
|
|
103 |
|
104 |
with gr.Blocks(css=css) as demo:
|
105 |
gr.Markdown(DESCRIPTION)
|
106 |
-
with gr.Tab(label="SmolVLM-
|
107 |
with gr.Row():
|
108 |
with gr.Column():
|
109 |
input_img = gr.Image(label="Input Picture")
|
|
|
13 |
|
14 |
This is a demo Space for a fine-tuned version of [SmolVLM](https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct) trained using [rlaif-v dataset](https://huggingface.co/datasets/HuggingFaceH4/rlaif-v_formatted).
|
15 |
|
16 |
+
The corresponding model is located [here](https://huggingface.co/HuggingFaceTB/SmolVLM-Instruct-DPO).
|
17 |
"""
|
18 |
|
19 |
model_id = "HuggingFaceTB/SmolVLM-Instruct"
|
|
|
72 |
text = processor.apply_chat_template(
|
73 |
messages, tokenize=False, add_generation_prompt=True
|
74 |
)
|
75 |
+
#image_inputs, video_inputs = process_vision_info(messages)
|
76 |
+
image_inputs = []
|
77 |
+
#image = messages['images'][0]
|
78 |
+
if image.mode != 'RGB':
|
79 |
+
image = image.convert('RGB')
|
80 |
+
image_inputs.append([image])
|
81 |
+
|
82 |
inputs = processor(
|
83 |
+
text=text,
|
84 |
images=image_inputs,
|
85 |
videos=video_inputs,
|
86 |
padding=True,
|
|
|
109 |
|
110 |
with gr.Blocks(css=css) as demo:
|
111 |
gr.Markdown(DESCRIPTION)
|
112 |
+
with gr.Tab(label="SmolVLM-Instruct-DPO Input"):
|
113 |
with gr.Row():
|
114 |
with gr.Column():
|
115 |
input_img = gr.Image(label="Input Picture")
|