Update app.py
Browse files
app.py
CHANGED
|
@@ -1028,40 +1028,16 @@ with gr.Blocks(title="Salamandra Vision 7B 路 ZeroGPU", css=custom_css,theme=gr.
|
|
| 1028 |
gr.Markdown("---")
|
| 1029 |
|
| 1030 |
# ---------------------
|
| 1031 |
-
# Section:
|
| 1032 |
# ---------------------
|
| 1033 |
-
gr.Markdown('<h2 style="text-align:center">
|
| 1034 |
with gr.Row():
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
-
|
| 1038 |
-
|
| 1039 |
-
|
| 1040 |
-
|
| 1041 |
-
with gr.Column():
|
| 1042 |
-
out = gr.Textbox(label="Descripci贸", lines=18)
|
| 1043 |
-
|
| 1044 |
-
btn.click(_infer_one, [in_img, in_txt, max_new, temp], out, api_name="describe", concurrency_limit=1)
|
| 1045 |
-
gr.Markdown("---")
|
| 1046 |
-
|
| 1047 |
-
# ---------------------
|
| 1048 |
-
# Section: Batch images
|
| 1049 |
-
# ---------------------
|
| 1050 |
-
gr.Markdown('<h2 style="text-align:center">Llot d鈥檌matges</h2>')
|
| 1051 |
-
batch_in_images = gr.Gallery(label="Llot d鈥檌matges", show_label=False, columns=4, height="auto")
|
| 1052 |
-
batch_context = gr.Textbox(label="context_json", value="{}", lines=4)
|
| 1053 |
-
batch_max = gr.Slider(16, 1024, value=256, step=16, label="m脿x_tokens nous")
|
| 1054 |
-
batch_temp = gr.Slider(0.0, 1.5, value=0.7, step=0.05, label="temperatura")
|
| 1055 |
-
batch_btn = gr.Button("Descriu el lot", variant="primary")
|
| 1056 |
-
batch_out = gr.JSON(label="Descripcions (llista)")
|
| 1057 |
-
|
| 1058 |
-
batch_btn.click(
|
| 1059 |
-
describe_batch,
|
| 1060 |
-
[batch_in_images, batch_context, batch_max, batch_temp],
|
| 1061 |
-
batch_out,
|
| 1062 |
-
api_name="predict",
|
| 1063 |
-
concurrency_limit=1
|
| 1064 |
-
)
|
| 1065 |
gr.Markdown("---")
|
| 1066 |
|
| 1067 |
# ---------------------
|
|
@@ -1090,19 +1066,6 @@ with gr.Blocks(title="Salamandra Vision 7B 路 ZeroGPU", css=custom_css,theme=gr.
|
|
| 1090 |
concurrency_limit=1
|
| 1091 |
)
|
| 1092 |
|
| 1093 |
-
# ---------------------
|
| 1094 |
-
# Section: Facial embeddings
|
| 1095 |
-
# ---------------------
|
| 1096 |
-
gr.Markdown('<h2 style="text-align:center">Embeddings facials</h2>')
|
| 1097 |
-
with gr.Row():
|
| 1098 |
-
face_img = gr.Image(label="Imatge per embedding facial", type="pil")
|
| 1099 |
-
with gr.Row():
|
| 1100 |
-
face_btn = gr.Button("Obt茅 embedding facial", variant="primary")
|
| 1101 |
-
with gr.Row():
|
| 1102 |
-
face_out = gr.JSON(label="Embedding facial (vector)")
|
| 1103 |
-
face_btn.click(face_image_embedding, [face_img], face_out, api_name="face_image_embedding", concurrency_limit=1)
|
| 1104 |
-
gr.Markdown("---")
|
| 1105 |
-
|
| 1106 |
# ---------------------
|
| 1107 |
# Section: Video scene extraction
|
| 1108 |
# ---------------------
|
|
@@ -1201,5 +1164,42 @@ with gr.Blocks(title="Salamandra Vision 7B 路 ZeroGPU", css=custom_css,theme=gr.
|
|
| 1201 |
concurrency_limit=1
|
| 1202 |
)
|
| 1203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1204 |
demo.queue(max_size=16).launch(show_error=True,share=True)
|
| 1205 |
|
|
|
|
| 1028 |
gr.Markdown("---")
|
| 1029 |
|
| 1030 |
# ---------------------
|
| 1031 |
+
# Section: Facial embeddings
|
| 1032 |
# ---------------------
|
| 1033 |
+
gr.Markdown('<h2 style="text-align:center">Embeddings facials</h2>')
|
| 1034 |
with gr.Row():
|
| 1035 |
+
face_img = gr.Image(label="Imatge per embedding facial", type="pil")
|
| 1036 |
+
with gr.Row():
|
| 1037 |
+
face_btn = gr.Button("Obt茅 embedding facial", variant="primary")
|
| 1038 |
+
with gr.Row():
|
| 1039 |
+
face_out = gr.JSON(label="Embedding facial (vector)")
|
| 1040 |
+
face_btn.click(face_image_embedding, [face_img], face_out, api_name="face_image_embedding", concurrency_limit=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1041 |
gr.Markdown("---")
|
| 1042 |
|
| 1043 |
# ---------------------
|
|
|
|
| 1066 |
concurrency_limit=1
|
| 1067 |
)
|
| 1068 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1069 |
# ---------------------
|
| 1070 |
# Section: Video scene extraction
|
| 1071 |
# ---------------------
|
|
|
|
| 1164 |
concurrency_limit=1
|
| 1165 |
)
|
| 1166 |
|
| 1167 |
+
# ---------------------
|
| 1168 |
+
# Section: Single image inference
|
| 1169 |
+
# ---------------------
|
| 1170 |
+
gr.Markdown('<h2 style="text-align:center">Infer猫ncia per imatge 煤nica</h2>')
|
| 1171 |
+
with gr.Row():
|
| 1172 |
+
with gr.Column():
|
| 1173 |
+
in_img = gr.Image(label="Imatge", type="pil")
|
| 1174 |
+
in_txt = gr.Textbox(label="Text/prompt", value="Descriu la imatge amb detall (ES/CA).")
|
| 1175 |
+
max_new = gr.Slider(16, 1024, value=256, step=16, label="m脿x_tokens nous")
|
| 1176 |
+
temp = gr.Slider(0.0, 1.5, value=0.7, step=0.05, label="temperatura")
|
| 1177 |
+
btn = gr.Button("Genera", variant="primary")
|
| 1178 |
+
with gr.Column():
|
| 1179 |
+
out = gr.Textbox(label="Descripci贸", lines=18)
|
| 1180 |
+
|
| 1181 |
+
btn.click(_infer_one, [in_img, in_txt, max_new, temp], out, api_name="describe", concurrency_limit=1)
|
| 1182 |
+
gr.Markdown("---")
|
| 1183 |
+
|
| 1184 |
+
# ---------------------
|
| 1185 |
+
# Section: Batch images
|
| 1186 |
+
# ---------------------
|
| 1187 |
+
gr.Markdown('<h2 style="text-align:center">Llot d鈥檌matges</h2>')
|
| 1188 |
+
batch_in_images = gr.Gallery(label="Llot d鈥檌matges", show_label=False, columns=4, height="auto")
|
| 1189 |
+
batch_context = gr.Textbox(label="context_json", value="{}", lines=4)
|
| 1190 |
+
batch_max = gr.Slider(16, 1024, value=256, step=16, label="m脿x_tokens nous")
|
| 1191 |
+
batch_temp = gr.Slider(0.0, 1.5, value=0.7, step=0.05, label="temperatura")
|
| 1192 |
+
batch_btn = gr.Button("Descriu el lot", variant="primary")
|
| 1193 |
+
batch_out = gr.JSON(label="Descripcions (llista)")
|
| 1194 |
+
|
| 1195 |
+
batch_btn.click(
|
| 1196 |
+
describe_batch,
|
| 1197 |
+
[batch_in_images, batch_context, batch_max, batch_temp],
|
| 1198 |
+
batch_out,
|
| 1199 |
+
api_name="predict",
|
| 1200 |
+
concurrency_limit=1
|
| 1201 |
+
)
|
| 1202 |
+
gr.Markdown("---")
|
| 1203 |
+
|
| 1204 |
demo.queue(max_size=16).launch(show_error=True,share=True)
|
| 1205 |
|