File size: 17,864 Bytes
461ddce
d55a3fa
2a3c800
461ddce
d55a3fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28515db
461ddce
6f2a4ac
f7ffbe2
 
2a3c800
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
882f950
7f60390
2a3c800
 
 
 
fc8b0e6
2a3c800
 
 
 
 
 
 
 
6fd5d01
2a3c800
 
 
 
 
 
6fd5d01
2a3c800
 
 
 
 
 
6fd5d01
2a3c800
 
 
 
 
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
 
b449aa4
1bcf949
2a3c800
 
5b4b168
 
 
c3ffdd7
 
 
 
2a3c800
3f0b524
80324d7
c3ffdd7
1d606ae
9980459
c3ffdd7
 
 
f897f91
c3ffdd7
34c95c1
5b4b168
0e620d3
d55a3fa
2a3c800
1a89a4f
 
 
 
 
 
 
 
 
 
 
 
2a3c800
9dc3ccd
2a3c800
85f133c
2a3c800
8411210
 
 
 
 
 
 
 
491691e
8411210
 
 
 
 
 
2a3c800
 
 
8411210
 
 
8e3310d
e05b111
8411210
 
 
 
5960330
 
8411210
 
5150702
 
 
8411210
 
2a3c800
 
 
 
 
1bcf949
3ffd2dc
6fd5d01
8411210
 
1a89a4f
 
6fd5d01
8411210
 
2a3c800
 
3ffd2dc
1a89a4f
2a3c800
1a89a4f
192cb21
2a3c800
 
 
 
 
 
192cb21
 
1a89a4f
2a3c800
 
 
461ddce
 
 
20b1263
685778e
461ddce
f7ffbe2
6f2a4ac
 
 
28515db
c7752e9
 
 
 
 
 
 
 
f7ffbe2
6a8ac6d
a194399
 
8420bc3
d55a3fa
 
2a3c800
 
 
d55a3fa
1ca4016
d55a3fa
 
20b1263
 
 
4242f3c
26b9125
20b1263
 
 
 
9349c38
20b1263
 
 
 
26b9125
20b1263
903bb5e
1a89a4f
dc62bb3
20b1263
 
4242f3c
1a89a4f
 
 
 
 
 
f012e76
26b9125
 
 
2a3c800
8411210
2a3c800
4a6c15b
dc62bb3
2a3c800
 
 
 
491691e
2a3c800
 
 
9dc3ccd
 
8411210
5960330
8411210
f012e76
97c5fb5
f012e76
 
26b9125
 
 
 
 
 
8eb0e97
2a3c800
 
 
 
20b1263
 
 
28515db
 
 
6f2a4ac
 
28515db
 
40f8ec5
d55a3fa
8411210
2a3c800
8411210
2a3c800
4a6c15b
85f133c
2a3c800
 
 
8411210
 
192cb21
049b50f
 
 
2a3c800
9cc1146
 
26b9125
9cc1146
 
 
 
2a3c800
 
 
 
d55a3fa
 
 
 
 
461ddce
d55a3fa
461ddce
d55a3fa
461ddce
d55a3fa
 
 
 
 
 
 
 
461ddce
d55a3fa
 
461ddce
 
 
 
 
f7ffbe2
 
 
 
 
685778e
 
 
 
 
 
 
 
 
cf5e8f1
 
685778e
 
 
f7ffbe2
 
 
6f2a4ac
f7ffbe2
6f2a4ac
2a3c800
 
461ddce
e8e823b
 
093b3a1
 
 
cf5e8f1
093b3a1
 
 
 
 
 
 
685778e
e8e823b
28515db
 
 
20b1263
 
685778e
83198b1
94902b6
83198b1
 
04998be
83198b1
 
ee3c674
 
28515db
461ddce
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
import gradio as gr
import re
import inspect

from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim


codes = """001 - Vehicle Registration (New)
002 - Vehicle Registration Renewal
003 - Vehicle Ownership Transfer
004 - Vehicle De-registration
005 - Lost Registration Certificate Replacement
006 - Address Change Update
007 - Vehicle Data Correction
008 - Ownership Name Correction
009 - Vehicle Tax Payment
010 - Late Payment Fee Processing
011 - Vehicle Type/Specification Update
012 - BBNKB (Transfer Fee of Vehicle Ownership)
013 - STNK Issuance (Vehicle Registration Certificate)
014 - STNK Renewal
015 - Motor Vehicle Roadworthiness Inspection
016 - Plate Number Renewal
017 - Lost Plate Replacement
018 - Vehicle Export Registration
019 - Vehicle Import Registration
020 - Fleet Vehicle Registration
021 - Bulk Vehicle Registration Update
022 - Vehicle Insurance Assistance
023 - Vehicle Accident Reporting
024 - Vehicle Usage Change Declaration (e.g., personal to commercial)
025 - Legal Document Verification
026 - Ownership Transfer for Inherited Vehicle
027 - STNK Temporary Suspension
028 - Proof of Ownership Document Update
029 - Vehicle Ownership History Check
030 - Vehicle Tax Recalculation Request
031 - Tax Exemption Application (for special cases)
032 - Deceased Owner’s Vehicle Ownership Transfer""".split("\n")

undetected = "099 - Other/Undetected"


# codes = """001 - Pendaftaran Kendaraan (Baru)
# 002 - Pembaruan Pendaftaran Kendaraan
# 003 - Alih Kepemilikan Kendaraan
# 004 - Pembatalan Pendaftaran Kendaraan
# 005 - Penggantian Sertifikat Pendaftaran Kendaraan yang Hilang
# 006 - Pembaruan Perubahan Alamat
# 007 - Koreksi Data Kendaraan
# 008 - Koreksi Nama Kepemilikan
# 009 - Pembayaran Pajak Kendaraan
# 010 - Proses Denda Keterlambatan Pembayaran
# 011 - Pembaruan Jenis/Spesifikasi Kendaraan
# 012 - Pembayaran Pajak Kendaraan Melalui E-Samsat
# 013 - Penerbitan STNK (Sertifikat Pendaftaran Kendaraan)
# 014 - Pembaruan STNK
# 015 - Pemeriksaan Kelayakan Jalan Kendaraan Bermotor
# 016 - Pembaruan Nomor Plat Kendaraan
# 017 - Penggantian Plat yang Hilang
# 018 - Pendaftaran Ekspor Kendaraan
# 019 - Pendaftaran Impor Kendaraan
# 020 - Pendaftaran Kendaraan Armada
# 021 - Pembaruan Pendaftaran Kendaraan Massal
# 022 - Bantuan Asuransi Kendaraan
# 023 - Pelaporan Kecelakaan Kendaraan
# 024 - Deklarasi Perubahan Penggunaan Kendaraan (misalnya, pribadi ke komersial)
# 025 - Verifikasi Dokumen Hukum
# 026 - Alih Kepemilikan Kendaraan Warisan
# 027 - Penangguhan Sementara STNK
# 028 - Pembaruan Dokumen Bukti Kepemilikan
# 029 - Pemeriksaan Riwayat Kepemilikan Kendaraan
# 030 - Permintaan Perhitungan Ulang Pajak Kendaraan
# 031 - Permohonan Pembebasan Pajak (untuk kasus khusus)
# 032 - Alih Kepemilikan Kendaraan Pemilik yang Meninggal""".split("\n")

codes = """001 - Pendaftaran Kendaraan
002 - Pembaruan Data Kendaraan
003 - Alih Kepemilikan (Balik Nama)
004 - Pelaporan Dokumen atau Plat yang Hilang
005 - Pembayaran dan Pengelolaan Pajak Kendaraan
006 - Pemeriksaan dan Verifikasi Kendaraan
007 - Pendaftaran Kendaraan Ekspor, Impor, atau Armada
008 - Pelaporan dan Bantuan Terkait Kendaraan
009 - Penangguhan atau Deklarasi Perubahan Penggunaan Kendaraan""".split("\n")


vehicle_tax_info = {
    "B 1234 BCA": {
        "no_rangka": "1237191234",
        "type": "SUV",
        "tanggal": "23 Desember 2024",
        "status": "Belum Bayar",
        "harga_jual": 500_000_000  # In Rupiah
    },
    "B 5678 XYZ": {
        "no_rangka": "9876543210",
        "type": "Sedan",
        "tanggal": "15 Januari 2025",
        "status": "Belum Bayar",
        "harga_jual": 375_800_000  # In Rupiah
    },
    "D 3456 DEF": {
        "no_rangka": "4561237890",
        "type": "MPV",
        "tanggal": "10 Februari 2025",
        "status": "Sudah Bayar",
        "harga_jual": 400_000_000  # In Rupiah
    }
}

# Table for detail calculations (perhitungan)
detail_perhitungan = {
    "001": {
        "name": "Pendaftaran Kendaraan",
        "formula": lambda harga_jual: harga_jual * 0.1,
        # Example formula: 10% of harga_jual
    },
    "002": {
        "name": "Pembaruan Data Kendaraan",
        "formula": lambda harga_jual: harga_jual * 0.05,
        # Example formula: 5% of harga_jual
    },
    "003": {
        "name": "Alih Kepemilikan Kendaraan",
        "formula": lambda harga_jual: harga_jual * 0.1,  
        # Example formula: 10% of harga_jual
    },
    "004": {
        "name": "Penggantian Dokumen atau Plat yang Hilang",
        "formula": lambda harga_jual: harga_jual * 0.03,
        # Example formula: 3% of harga_jual
    },
    "005": {
        "name": "Pembayaran dan Pengelolaan Pajak Kendaraan",
        "formula": lambda harga_jual: harga_jual * 0.12,
        # Example formula: 12% of harga_jual
    },
    "006": {
        "name": "Pemeriksaan dan Verifikasi Kendaraan",
        "formula": lambda harga_jual: 100000,
        # Example formula: 2% of harga_jual
    },
    "007": {
        "name": "Pendaftaran Kendaraan Ekspor, Impor, atau Armada",
        "formula": lambda harga_jual: harga_jual * 0.15,
        # Example formula: 15% of harga_jual
    },
    "008": {
        "name": "Pelaporan dan Bantuan Terkait Kendaraan",
        "formula": lambda harga_jual: harga_jual * 0.04,
        # Example formula: 4% of harga_jual
    },
    "009": {
        "name": "Penangguhan atau Deklarasi Perubahan Penggunaan Kendaraan",
        "formula": lambda harga_jual: harga_jual * 0.06,
        # Example formula: 6% of harga_jual
    }
}

undetected = "099 - Lainnya/Tidak Terdeteksi"

model_ids = [
    "BAAI/bge-m3",
    "sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
    "intfloat/multilingual-e5-small",
    "sentence-transformers/distiluse-base-multilingual-cased-v2",
    "Alibaba-NLP/gte-multilingual-base",
    "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
]
# model_id = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
# model_id = "Alibaba-NLP/gte-multilingual-base"
# model_id = "BAAI/bge-m3"
# model_id = "sentence-transformers/paraphrase-multilingual-mpnet-base-v2"
# model_id = "intfloat/multilingual-e5-small"
# model_id = "sentence-transformers/distiluse-base-multilingual-cased-v2"
model_id = model_ids[-1]
model = SentenceTransformer(model_id, trust_remote_code=True)

codes_emb = model.encode([x[6:] for x in codes])


def censor_middle(number, num_to_hide=4):
  number_str = str(number)
  middle_index = len(number_str) // 2
  start_index = middle_index - num_to_hide // 2
  end_index = middle_index + num_to_hide // 2

  censored_part = "*" * num_to_hide
  censored_number = number_str[:start_index] + censored_part + number_str[end_index:]

  return censored_number


def get_calculation(request_code, plate_number):
    print(request_code, plate_number, "GET CALC")
    calc = detail_perhitungan.get(request_code)
    vehicle = vehicle_tax_info.get(plate_number)
    
    if vehicle != None and calc != None:
        harga_jual = vehicle.get("harga_jual")
        formula = calc.get("formula")
        result = formula(harga_jual)
        description = inspect.getsource(formula).split(":", 2)[-1].strip()
        result_detail = request_code + " - " + calc.get("name")
        return result, str(description), result_detail

    elif calc != None:
        formula = calc.get("formula")
        description = inspect.getsource(formula).split(":", 2)[-1].strip()
        result_detail = request_code + " - " + calc.get("name")
        return None, str(description), result_detail

    else:
        return None, None, None


def build_output_formula(descriptions, result_details):
    out = "----------------------------------------------------\n\n"
    out = "Daftar Kode Permohonan:\n"
    for i, (desc,detail) in enumerate(zip(descriptions, result_details)):
        # harga_jual = str(vehicle.get("harga_jual"))
        out += f"{i+1}. {detail}\nRumus: {desc}\n"
    return out


def build_output_vehicle(plate_number):
    vehicle = vehicle_tax_info.get(plate_number)
    out = "----------------------------------------------------\n\n"
    out = "Nomor Polisi: " + plate_number + "\n"
    vehicle["no_rangka"] = censor_middle(vehicle["no_rangka"])
    vehicle["harga_jual"] = "{:,}".format(vehicle["harga_jual"])
    out += "\n".join([k + " : " + str(v) for  k,v in vehicle.items()])
    return out

def build_output(result, description, result_detail, plate_number):
    return build_outputs([result], [description], [result_detail], plate_number)


def build_outputs(results, descriptions, result_details, plate_number):
    vehicle = vehicle_tax_info.get(plate_number)
    vehicle["harga_jual"] = "{:,}".format(vehicle["harga_jual"])

    out = "----------------------------------------------------\n\n"
    out = "Nomor Polisi: " + plate_number + "\n"
    out += "\n".join([k + " : " + str(v) if k != "no_rangka" else k + " : " + censor_middle(v) for  k,v in vehicle.items()])
    # out += "\n----------------------------------------------"
    
    # out += f"\nWajib Pajak dengan NoPol {plate_number} ingin melakukan proses berikut:\n"
    out += "\n\nDaftar Kode Permohonan:\n"

    for i, (res,desc,detail) in enumerate(zip(results, descriptions, result_details)):
        harga_jual = vehicle["harga_jual"]
        out += f"{i+1}. {detail}\nRumus: {desc}\nDetail perhitungan: {desc.replace('harga_jual', harga_jual)} = {res}\n"

    # out += "----------------------------\nEstimasi biaya: "
    out += "\n\n\nEstimasi Biaya: "

    if len(results) > 1:
        out += " + ".join([f"Rp{x}" for x in results])
        out += f" = {sum(results)}"
    else:
        out += str(results[0])

    out += "\n\n----------------------------"
    # out += "\n----------------------------\n\n--------------------------------"
    return out
    

def respond(
    message,
    history: list[tuple[str, str]],
    threshold,
    is_multiple
):
    global codes_emb
    global undetected

    undetected_code = undetected[:3]

    # if history and history[-1][-1][21:24] == undetected_code: 
    #     list_his = ""
    #     for his in history[::-1]:
    #         if his[-1][21:24] != undetected_code:
    #             break
    #         list_his = his[0] + "\n" + list_his

    #     message += "\n" + list_his
    
    # pattern = r'\b([A-Z]{1,2})\s?(\d{4})\s?([A-Z]{3})\b'
    # pattern = r'\b([A-Z]{1,2})\s?(\d{4})\s?([A-Z]{1,3})\b'
    pattern = r'\b([A-Za-z]{1,2})\s?(\d{4})\s?([A-Za-z]{1,3})\b'

    matches = re.findall(pattern, message)

    plates = [" ".join(x).upper() for i,x in enumerate(matches)]

    plate_numbers = ", ".join(plates)
    
    text_emb = model.encode(message)
    scores = cos_sim(codes_emb, text_emb)[:,0]

    if is_multiple:
        request_details = []
        request_numbers = []
        request_scores = []
        # request_undetected = False
        for i,score in enumerate(scores):
            if score > threshold:
                request_details.append(codes[i][6:])
                request_numbers.append(codes[i][:3])
                request_scores.append(str( round(score.tolist(), 3) ) )

        if not request_details:
            request_details.append(undetected[6:])
            request_numbers.append(undetected_code)
            

        request_numbers_copy = request_numbers
        request_details_copy = request_details

        request_numbers = "\n".join(request_numbers)
        request_details = "\n".join(request_details)
        request_scores = "\n".join(request_scores)

        # if len(request_numbers_copy) > 0:
        #     for code, detail in zip(request_numbers_copy, request_details_copy):
        #         kode_mohon = detail_perhitungan.get(code)
        #         formula = kode_mohon.get("formula")
        #         description = inspect.getsource(formula).split(":", 2)[-1].strip()

        # if request_undetected and len(plates) == 0:
            # + f"\n\nConfidence score:\n{request_scores}"
            # return "Request code number:\n" + request_numbers + "\n\nRequest detail:\n" + request_details + "\n\nPlate numbers: " + plate_numbers
        
        out = ""
        for plate in plates:
            results, descriptions, result_details = [], [], []
            for code in request_numbers_copy:
                result, description, result_detail = get_calculation(code, plate)

                if result != None:
                    results.append(result)
                if descriptions != None:
                    descriptions.append(description)
                    result_details.append(result_detail)

            if results:
                out += "\n\n" + build_outputs(results, descriptions, result_details, plate)
            elif vehicle_tax_info.get(plate):
                out += "\n\n" + build_output_vehicle(plate)

        if out == "":
            descriptions, result_details = [], []
            for code in request_numbers_copy:
                result, description, result_detail = get_calculation(code, "")
                if description != None:
                    descriptions.append(description)
                    result_details.append(result_detail)
            if descriptions:
                out += "\n\n" + build_output_formula(descriptions, result_details)
            else:
                return "Request code number: " + request_numbers + "\nRequest detail: " + request_details + "\nPlate numbers: " + plate_numbers

        return out

        # result, description, result_detailget_calculation(request_code, plate_number)



    s_max = scores.argmax()

    if scores[s_max] < threshold:
        # request_code = "033 - Other/Undetected"
        request_code = undetected
    else:
        request_code = codes[scores.argmax()]
        # "{:.2f}".format(a)

    # out = "Request code number: " + request_code[:3] + "\nRequest detail: " + request_code[6:] + f"\nConfidence score: {round(scores[s_max].tolist(),3)}" + "\nPlate numbers: " + plate_numbers

    out = ""
    for plate in plates:
        results, descriptions, result_details = [], [], []
        result, description, result_detail = get_calculation(request_code[:3], plate)

        if result != None:
            results.append(result)
            out += "\n\n" + build_outputs(results, descriptions, result_details, plate)
        elif vehicle_tax_info.get(plate):
            out += "\n\n" + build_output_vehicle(plate)
        # else:
        #     # + f"\nConfidence score: {round(scores[s_max].tolist(),3)}"
        #     out += "Request code number: " + request_code[:3] + "\nRequest detail: " + "\nPlate numbers: " + plate_numbers

    if out == "":
        if request_code[:3] == undetected_code:
            return "Request code number: " + request_code[:3] + "\nRequest detail: " + request_code[6:] + "\nPlate numbers: " + plate_numbers
        else:
            result, description, result_detail = get_calculation(request_code[:3], "")
            out = build_output_formula([description], [result_detail])

    return out
    
    # if vehicle_tax_info.get(request_detail)
    
    # for val in history:
    #     if val[0]:
    #         messages.append({"role": "user", "content": val[0]})
    #     if val[1]:
    #         messages.append({"role": "assistant", "content": val[1]})

    # messages.append({"role": "user", "content": message})

    # response = ""

    # for message in client.chat_completion(
    #     messages,
    #     max_tokens=max_tokens,
    #     stream=True,
    #     temperature=temperature,
    #     top_p=top_p,
    # ):
    #     token = message.choices[0].delta.content

    #     response += token
    #     yield response


"""
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
"""
# demo = gr.ChatInterface(
#     respond,
# )


def reload(chosen_model_id):
    global model
    global model_id
    global codes_emb

    if chosen_model_id != model_id:
        model = SentenceTransformer(chosen_model_id, trust_remote_code=True)
        model_id = chosen_model_id
        codes_emb = model.encode([x[6:] for x in codes])
        return f"Model {chosen_model_id} has been succesfully loaded!"
    return f"Model {chosen_model_id} is ready!"
    


with gr.Blocks() as demo:
    # Add header title and description
    gr.Markdown("# List of Request Numbers")
    gr.Markdown("<br>".join(codes) + "<br>" + undetected)
    gr.Markdown("# Valid License Plate Number Criteria:")
    gr.Markdown("(1-2 letters) (4 numbers) (1-3 letters)")
    gr.Markdown("# Example Valid Plate Numbers")
    gr.Markdown("<br>".join(vehicle_tax_info.keys()))


    gr.Markdown("# Choose & Load Model:")
    reload_model = gr.Interface(
        fn=reload, 
        inputs=[gr.Dropdown(choices=model_ids, value=model_id)], 
        outputs="text",
        # gr.HighlightedText(
        #     label="status",
        #     combine_adjacent=True,
        #     show_legend=True,
        #     color_map={"+": "red", "-": "green"}
        # ),
    )

    gr.Markdown("# Chatbot Interface:")
    chat_interface = gr.ChatInterface(
        respond, 
        additional_inputs=[
            gr.Number(0.5, label="confidence threshold", show_label=True, minimum=0., maximum=1.0, step=0.1),
            gr.Checkbox(label="multiple", info="Allow multiple request code numbers"),
            
        ],
        # type="messages",
        chatbot=gr.Chatbot(height=800),
        # textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
        # title="SamSat Virtual Assistant",
        # description="Ask Yes Man any question",
        # theme="soft",
        # examples=["balik nama D 3456 DEF", "bayar pajak B 1234 BCA", "halo, selamat pagi!"],
        # cache_examples=True,
    )

if __name__ == "__main__":
    demo.launch()