Spaces:
Running
Running
Add color
Browse files
app.py
CHANGED
|
@@ -79,8 +79,16 @@ def search_kbli(text: str):
|
|
| 79 |
# `inputs` adalah jenis input (dalam hal ini, sebuah teks)
|
| 80 |
# `outputs` adalah jenis output (dalam hal ini, sebuah JSON)
|
| 81 |
# `api_name` adalah nama endpoint API
|
| 82 |
-
with gr.Blocks(
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
with gr.Tab("Embedding Only"):
|
| 86 |
inp1 = gr.Textbox(label="Masukkan teks")
|
|
@@ -88,8 +96,8 @@ with gr.Blocks() as demo:
|
|
| 88 |
inp1.submit(get_embedding, inp1, out1, api_name="get_embedding")
|
| 89 |
|
| 90 |
with gr.Row():
|
| 91 |
-
btn_submit1 = gr.Button("Submit")
|
| 92 |
-
btn_clear1 = gr.Button("Clear")
|
| 93 |
|
| 94 |
btn_submit1.click(get_embedding, inp1, out1, api_name="get_embedding")
|
| 95 |
btn_clear1.click(lambda: ("", None), None, [inp1, out1])
|
|
@@ -100,8 +108,8 @@ with gr.Blocks() as demo:
|
|
| 100 |
inp2.submit(search_kbli, inp2, out2, api_name="search_kbli")
|
| 101 |
|
| 102 |
with gr.Row():
|
| 103 |
-
btn_submit2 = gr.Button("Submit")
|
| 104 |
-
btn_clear2 = gr.Button("Clear")
|
| 105 |
|
| 106 |
btn_submit2.click(search_kbli, inp2, out2, api_name="search_kbli")
|
| 107 |
btn_clear2.click(lambda: ("", None), None, [inp2, out2])
|
|
|
|
| 79 |
# `inputs` adalah jenis input (dalam hal ini, sebuah teks)
|
| 80 |
# `outputs` adalah jenis output (dalam hal ini, sebuah JSON)
|
| 81 |
# `api_name` adalah nama endpoint API
|
| 82 |
+
with gr.Blocks(css="""
|
| 83 |
+
.title {font-size: 22px; font-weight: 700; color: #111827; margin-bottom: 4px;}
|
| 84 |
+
.desc {font-size: 14px; color: #6b7280; margin-bottom: 16px;}
|
| 85 |
+
.btn-primary {background-color: #2563eb; color: white; border-radius: 6px;}
|
| 86 |
+
.btn-primary:hover {background-color: #1d4ed8;}
|
| 87 |
+
.btn-clear {background-color: #f3f4f6; color: #374151; border-radius: 6px;}
|
| 88 |
+
.btn-clear:hover {background-color: #e5e7eb;}
|
| 89 |
+
""") as demo:
|
| 90 |
+
gr.Markdown("<div class='title'>Semantic KBLI Search</div>")
|
| 91 |
+
gr.Markdown("<div class='desc'>Cari kode KBLI dengan semantic search (Embedding + Matching)</div>")
|
| 92 |
|
| 93 |
with gr.Tab("Embedding Only"):
|
| 94 |
inp1 = gr.Textbox(label="Masukkan teks")
|
|
|
|
| 96 |
inp1.submit(get_embedding, inp1, out1, api_name="get_embedding")
|
| 97 |
|
| 98 |
with gr.Row():
|
| 99 |
+
btn_submit1 = gr.Button("Submit", elem_classes="btn-primary")
|
| 100 |
+
btn_clear1 = gr.Button("Clear", elem_classes="btn-clear")
|
| 101 |
|
| 102 |
btn_submit1.click(get_embedding, inp1, out1, api_name="get_embedding")
|
| 103 |
btn_clear1.click(lambda: ("", None), None, [inp1, out1])
|
|
|
|
| 108 |
inp2.submit(search_kbli, inp2, out2, api_name="search_kbli")
|
| 109 |
|
| 110 |
with gr.Row():
|
| 111 |
+
btn_submit2 = gr.Button("Submit", elem_classes="btn-primary")
|
| 112 |
+
btn_clear2 = gr.Button("Clear", elem_classes="btn-clear")
|
| 113 |
|
| 114 |
btn_submit2.click(search_kbli, inp2, out2, api_name="search_kbli")
|
| 115 |
btn_clear2.click(lambda: ("", None), None, [inp2, out2])
|