feat: add category selection
Browse files
demo.py
CHANGED
@@ -28,12 +28,12 @@ def translate_en_to_ko(text):
|
|
28 |
return f"๋ฒ์ญ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}"
|
29 |
|
30 |
|
31 |
-
def critic_image(image, language):
|
32 |
img_base64 = encode_image_to_base64(image)
|
33 |
payload = {
|
34 |
"input": {
|
35 |
"max_new_tokens": 512,
|
36 |
-
"category":
|
37 |
"image": img_base64
|
38 |
}
|
39 |
}
|
@@ -55,11 +55,19 @@ def critic_image(image, language):
|
|
55 |
return analysis_result # ์์ด ๊ทธ๋๋ก ๋ฐํ
|
56 |
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
demo = gr.Interface(
|
59 |
fn=critic_image,
|
60 |
inputs=[
|
61 |
gr.Image(type="pil"),
|
62 |
-
gr.Radio(choices=["EN", "KO"], label="Select Language", value="EN")
|
|
|
63 |
],
|
64 |
outputs="text",
|
65 |
title="Gemmarte",
|
|
|
28 |
return f"๋ฒ์ญ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}"
|
29 |
|
30 |
|
31 |
+
def critic_image(image, language, category):
|
32 |
img_base64 = encode_image_to_base64(image)
|
33 |
payload = {
|
34 |
"input": {
|
35 |
"max_new_tokens": 512,
|
36 |
+
"category": category,
|
37 |
"image": img_base64
|
38 |
}
|
39 |
}
|
|
|
55 |
return analysis_result # ์์ด ๊ทธ๋๋ก ๋ฐํ
|
56 |
|
57 |
|
58 |
+
categories = [
|
59 |
+
'General Visual Analysis', 'Form and Shape', 'Symbolism and Iconography',
|
60 |
+
'Composition', 'Color Palette', 'Light and Shadow', 'Texture',
|
61 |
+
'Movement and Gesture', 'Line Quality', 'Perspective', 'Scale and Proportion'
|
62 |
+
]
|
63 |
+
|
64 |
+
|
65 |
demo = gr.Interface(
|
66 |
fn=critic_image,
|
67 |
inputs=[
|
68 |
gr.Image(type="pil"),
|
69 |
+
gr.Radio(choices=["EN", "KO"], label="Select Language", value="EN"),
|
70 |
+
gr.Dropdown(choices=categories, label="Select Category", value="General Visual Analysis")
|
71 |
],
|
72 |
outputs="text",
|
73 |
title="Gemmarte",
|