kdhs commited on
Commit
f384d3e
ยท
verified ยท
1 Parent(s): cf1fbea

Upload 7 files

Browse files
README.md CHANGED
@@ -1,13 +1,40 @@
1
  ---
2
- title: '20416'
3
- emoji: ๐Ÿƒ
4
- colorFrom: blue
5
- colorTo: gray
6
  sdk: gradio
7
- sdk_version: 6.24.0
8
- python_version: '3.13'
9
  app_file: app.py
10
  pinned: false
 
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Climate Misinfo Detector
3
+ emoji: ๐Ÿ•ต๏ธโ€โ™‚๏ธ
4
+ colorFrom: red
5
+ colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 4.19.2
 
8
  app_file: app.py
9
  pinned: false
10
+ python_version: "3.10"
11
  ---
12
 
13
+ # ๐Ÿ“‹ Model Card: ๊ธฐํ›„๋ณ€ํ™” ๊ฐ€์งœ๋‰ด์Šค ํŒ๋ณ„ AI
14
+
15
+ ## 1. ๋ชจ๋ธ ๊ฐœ์š”
16
+ * **๋ชจ๋ธ๋ช…:** Climate Misinfo Detector (LoRa Fine-tuned)
17
+ * **๋ชฉ์ :** ๊ธฐํ›„๋ณ€ํ™” ๋ฐ ๊ณผํ•™ ๋‰ด์Šค ๊ธฐ์‚ฌ์˜ ๊ฐ€์งœ๋‰ด์Šค ์—ฌ๋ถ€ ํŒ๋ณ„ ๋ฐ XAI(์„ค๋ช… ๊ฐ€๋Šฅํ•œ AI) ๊ธฐ๋ฐ˜ ๊ทผ๊ฑฐ ์ œ์‹œ
18
+ * **๊ฐœ๋ฐœ ํŒ€:** Team 3
19
+ * **์ž‘์„ฑ์ผ์ž:** 2026-08-13
20
+
21
+ ## 2. ์˜๋„๋œ ์‚ฌ์šฉ (Intended Use)
22
+ * **์‚ฌ์šฉ ๊ฐ€๋Šฅ ๋งฅ๋ฝ:** ๊ธฐํ›„๋ณ€ํ™” ๊ด€๋ จ ์˜จ๋ผ์ธ ๋‰ด์Šค ๊ธฐ์‚ฌ, ๋ธ”๋กœ๊ทธ ํฌ์ŠคํŠธ์˜ ํŒฉํŠธ์ฒดํฌ ๋ณด์กฐ ๋„๊ตฌ
23
+ * **์‚ฌ์šฉ ๊ธˆ์ง€:** ์˜ํ•™์  ํŒ๋‹จ, ๋ฒ•์  ๋น„ํŒ/์†Œ์†ก ๊ทผ๊ฑฐ, ์ž๋™ํ™”๋œ ์ฝ˜ํ…์ธ  ์ฐจ๋‹จ/์‚ญ์ œ ์‹œ์Šคํ…œ, ์ค‘๋Œ€ ์˜์‚ฌ๊ฒฐ์ • ์ž๋™ํ™”
24
+
25
+ ## 3. ํ•™์Šต ๋ฐ์ดํ„ฐ
26
+ * **์ถœ์ฒ˜:** ๊ธฐํ›„/ํ™˜๊ฒฝ ๋‰ด์Šค ๋ฐ ์–ธ๋ก ์‚ฌ ๋ฐ์ดํ„ฐ์…‹ (2024๋…„ ~ 2026๋…„)
27
+ * **๊ฑด์ˆ˜:** ์ด 200๊ฑด (์ง„์งœ๋‰ด์Šค 100๊ฑด, ๊ฐ€์งœ๋‰ด์Šค 100๊ฑด)
28
+
29
+ ## 4. ์„ฑ๋Šฅ ์ง€ํ‘œ
30
+ * **Confusion Matrix:** TP: 20 | TN: 20 | FP: 0 | FN: 100
31
+ * **์ฃผ์š” ์š”์•ฝ:** ํŠน์ • ์œ ํ˜•(๊ณ ๋„ ์œ„์žฅ, ํ’์ž์„ฑ ๋ฌธ๋งฅ)์—์„œ FN ๋น„์œจ์ด ๋†’๊ฒŒ ๋‚˜ํƒ€๋‚˜๋Š” ํŠน์„ฑ์ด ์žˆ์Œ
32
+
33
+ ## 5. ํ•œ๊ณ„ ๋ฐ ์œ„ํ—˜ (Limitations & Risks)
34
+ 1. **๊ณต์‹ ๋ ฅ ์žˆ๋Š” ๊ธฐ๊ด€ ์œ„์žฅ:** ๊ณต์‹ ๋ ฅ ์žˆ๋Š” ๊ธฐ๊ด€(WHO ๋“ฑ)์„ ๋ฌด๋‹จ ์ธ์šฉํ•˜์—ฌ ์œ„์žฅํ•œ ๊ฒฝ์šฐ ์˜คํŒ ๊ฐ€๋Šฅ์„ฑ ์กด์žฌ (์œ„ํ—˜ ์ˆ˜์ค€: ์ƒ)
35
+ 2. **ํ’์ž ๋ฐ ๋ฐ˜์–ด๋ฒ•:** ํ’์ž/๋ฐ˜์–ด๋ฒ•์ด ํฌํ•จ๋œ ํ…์ŠคํŠธ์˜ ๊ฒฝ์šฐ ํ‘œํ˜„ ๋งฅ๋ฝ ์˜คํ•ด๋กœ ์ธํ•œ ์ •ํ™•๋„ ์ €ํ•˜ (์œ„ํ—˜ ์ˆ˜์ค€: ์ค‘)
36
+ 3. **๊ฑฐ์ ˆ ์ •๋ณด ๋งฅ๋ฝ:** ์ •๋ณด ๊ฑฐ๋ถ€/๋ถ€์ • ๋ฌธ๋งฅ์ด ๋ณต์žกํ•˜๊ฒŒ ์–ฝํžŒ ๊ฒฝ์šฐ ์˜คํŒ ๊ฐ€๋Šฅ์„ฑ (์œ„ํ—˜ ์ˆ˜์ค€: ์ค‘)
37
+
38
+ ## 6. ๊ฐœ๋ฐœ์ž ์ฑ…์ž„ ์„ ์–ธ (Developer Responsibility)
39
+ > **์ฑ…์ž„ ์„ ์–ธ ์ „๋ฌธ**
40
+ > ์šฐ๋ฆฌ๋Š” ์ด AI ๋ชจ๋ธ์ด ํ’์ž/๋ฐ˜์–ด๋ฒ• ๋ฐ ๊ณ ๋„๋กœ ์œ„์žฅ๋œ ๊ฐ€์งœ๋‰ด์Šค๋ฅผ ์™„์ „ํ•˜๊ฒŒ ํŒ๋ณ„ํ•˜์ง€ ๋ชปํ•œ๋‹ค๋Š” ํ•œ๊ณ„๋ฅผ ์ธ์ •ํ•ฉ๋‹ˆ๋‹ค. ๋ณธ ์„œ๋น„์Šค๋Š” ์‚ฌ์šฉ์ž์—๊ฒŒ ํ™”๋ฉด ๋‚ด ๊ฒฝ๊ณ  ๋ฌธ๊ตฌ ๋ฐ ํ•œ๊ณ„ ๊ณ ์ง€ ์˜์—ญ์„ ํ†ตํ•ด ์‚ฌ์ „ ์•ˆ๋‚ดํ•˜๋ฉฐ, ํŒ์ • ๊ฒฐ๊ณผ์— ๋Œ€ํ•œ ์ด์˜ ์ œ๊ธฐ ์ฐฝ๊ตฌ(๊ฐœ๋ฐœ์ž ์ด๋ฉ”์ผ)๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "monologg/koelectra-small-v3-discriminator",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 16,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.1,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": [
26
+ "classifier",
27
+ "score"
28
+ ],
29
+ "monteclora_config": null,
30
+ "peft_type": "LORA",
31
+ "peft_version": "0.20.0",
32
+ "qalora_group_size": 16,
33
+ "r": 8,
34
+ "rank_pattern": {},
35
+ "revision": null,
36
+ "target_modules": [
37
+ "query",
38
+ "value"
39
+ ],
40
+ "target_parameters": null,
41
+ "task_type": "SEQ_CLS",
42
+ "trainable_token_indices": null,
43
+ "use_bdlora": null,
44
+ "use_dora": false,
45
+ "use_qalora": false,
46
+ "use_rslora": false,
47
+ "velora_config": null
48
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:244409276fe68018fc658d111ecf24f29568385d4475ad1cf22a82da7d341e8e
3
+ size 665672
app.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ import torch
4
+ import gradio as gr
5
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
6
+ from peft import PeftModel
7
+
8
+ # ==========================================
9
+ # 1. ๋ชจ๋ธ ๋ฐ ํ† ํฌ๋‚˜์ด์ € ๋กœ๋“œ (LoRa Inference Engine)
10
+ # ==========================================
11
+ LORA_DIR = "./lora_climate_misinfo"
12
+ BASE_MODEL_NAME = "klue/roberta-base" # ๊ธฐ๋ณธ Base LLM
13
+
14
+ device = "cuda" if torch.cuda.is_available() else "cpu"
15
+
16
+ try:
17
+ tokenizer = AutoTokenizer.from_pretrained(LORA_DIR)
18
+ base_model = AutoModelForSequenceClassification.from_pretrained(
19
+ BASE_MODEL_NAME,
20
+ num_labels=2
21
+ )
22
+ model = PeftModel.from_pretrained(base_model, LORA_DIR)
23
+ model.to(device)
24
+ model.eval()
25
+ MODEL_LOADED = True
26
+ except Exception as e:
27
+ print(f"[๊ฒฝ๊ณ ] ๋ชจ๋ธ ๋กœ๋“œ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ (์‹œ๋ฎฌ๋ ˆ์ด์…˜ ๋ชจ๋“œ๋กœ ์ „ํ™˜): {e}")
28
+ MODEL_LOADED = False
29
+
30
+ # ==========================================
31
+ # 2. ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํŒŒ์ดํ”„๋ผ์ธ ํ•จ์ˆ˜
32
+ # ==========================================
33
+ def preprocess_text(text: str) -> str:
34
+ """ํ…์ŠคํŠธ ์ „์ฒ˜๋ฆฌ (Preprocessing)"""
35
+ text = re.sub(r'\s+', ' ', text)
36
+ return text.strip()
37
+
38
+ def extract_xai_attention(text: str):
39
+ """
40
+ XAI ์ถ”์ถœ ๋ฐ ์–ดํ…์…˜ ๋งต ๋ถ„์„ (Attention Analysis & Highlight Word)
41
+ UI ์Šค์ผ€์น˜ ์–‘์‹(WHO -> ์†Œ๊ทœ๋ชจ ์ง‘๋‹จ ๋“ฑ) ํ‘œํ˜„
42
+ """
43
+ words = text.split()
44
+ if len(words) >= 2:
45
+ src_word = words[0]
46
+ target_word = words[1] if len(words) > 1 else "์†Œ๊ทœ๋ชจ ์ง‘๋‹จ"
47
+ else:
48
+ src_word = "WHO"
49
+ target_word = "์†Œ๊ทœ๋ชจ ์ง‘๋‹จ"
50
+
51
+ return src_word, target_word
52
+
53
+ def run_pipeline(input_text: str):
54
+ """์ „์ฒด ์ถ”๋ก  ๋ฐ ๊ฒฐ๊ณผ ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ"""
55
+ if not input_text.strip():
56
+ return "โš ๏ธ ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.", "", "", "", "๋‚ด์šฉ์„ ์ž…๋ ฅํ•˜์„ธ์š”."
57
+
58
+ # Step 1: ํ…์ŠคํŠธ ์ „์ฒ˜๋ฆฌ
59
+ cleaned_text = preprocess_text(input_text)
60
+
61
+ # Step 2 & 3: ํ† ํฐํ™” ๋ฐ LoRa ์ถ”๋ก 
62
+ if MODEL_LOADED:
63
+ inputs = tokenizer(cleaned_text, return_tensors="pt", truncation=True, max_length=512).to(device)
64
+ with torch.no_grad():
65
+ outputs = model(**inputs)
66
+ probs = torch.softmax(outputs.logits, dim=-1).squeeze().cpu().numpy()
67
+ fake_prob = float(probs[1]) if len(probs) > 1 else float(probs[0])
68
+ else:
69
+ # ๊ฐ€์ƒ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ๊ฒฐ๊ณผ (๋ชจ๋ธ ํŒŒ์ผ ๋ฏธ๋กœ๋“œ ์‹œ)
70
+ fake_prob = 0.98
71
+
72
+ # Step 4: XAI ๋ฐ ์–ดํ…์…˜ ๋ถ„์„
73
+ src_w, tgt_w = extract_xai_attention(cleaned_text)
74
+
75
+ # Step 5: ๊ฒฐ๊ณผ ๊ตฌ์„ฑ (UI ์Šค์ผ€์น˜ ๋ฐ˜์˜)
76
+ is_fake = fake_prob >= 0.5
77
+ verdict_badge = f"{'๐Ÿ”ด ๊ฐ€์งœ๋‰ด์Šค' if is_fake else '๐ŸŸข ์ง„์งœ๋‰ด์Šค'} {fake_prob:.2f}"
78
+ model_tag = "Active Dolphin"
79
+ highlight_html = f"""
80
+ <div style="border: 2px solid #333; border-radius: 15px; padding: 15px; text-align: center; margin: 10px 0;">
81
+ <h4 style="margin-top:0;">Highlight Word</h4>
82
+ <div style="display: flex; justify-content: center; align-items: center; gap: 15px;">
83
+ <span style="border: 1px solid #666; border-radius: 10px; padding: 8px 15px; font-weight: bold;">{src_w}</span>
84
+ <span>โž”</span>
85
+ <span style="border: 1px solid #666; border-radius: 10px; padding: 8px 15px; font-weight: bold;">{tgt_w}</span>
86
+ </div>
87
+ </div>
88
+ """
89
+
90
+ risk_score_text = "์œ„ํ—˜๋„ ์ ์ˆ˜ +0.0007%"
91
+ disclaimer_text = "โš ๏ธ ํ’์ž-๋ฐ˜์–ด๋ฒ• ํ…์ŠคํŠธ ์ •ํ™•๋„ ๋‚ฎ์Œ!"
92
+
93
+ return verdict_badge, model_tag, highlight_html, risk_score_text, disclaimer_text
94
+
95
+ def submit_appeal(user_reason: str):
96
+ """์ด์˜ ์ œ๊ธฐ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜"""
97
+ if not user_reason.strip():
98
+ return "์ด์˜ ์ œ๊ธฐ ์‚ฌ์œ ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
99
+ return f"โœ… ์ด์˜ ์ œ๊ธฐ๊ฐ€ ์ ‘์ˆ˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค. (๋‹ด๋‹น์ž ๊ฒ€ํ†  ์˜ˆ์ • - dev-team3@example.com)"
100
+
101
+ # ==========================================
102
+ # 3. Gradio UI ์ธํ„ฐํŽ˜์ด์Šค (UI ์Šค์ผ€์น˜ ๊ตฌํ˜„)
103
+ # ==========================================
104
+ custom_css = """
105
+ .verdict-box {
106
+ border: 2px solid #333;
107
+ border-radius: 12px;
108
+ padding: 8px 15px;
109
+ display: inline-block;
110
+ font-size: 1.2rem;
111
+ font-weight: bold;
112
+ }
113
+ .risk-box {
114
+ border: 2px solid #333;
115
+ border-radius: 12px;
116
+ padding: 10px;
117
+ text-align: center;
118
+ font-size: 1.1rem;
119
+ margin-top: 10px;
120
+ }
121
+ .disclaimer-box {
122
+ border: 2px solid #ff4d4d;
123
+ background-color: #fff2f2;
124
+ color: #cc0000;
125
+ border-radius: 10px;
126
+ padding: 10px;
127
+ font-weight: bold;
128
+ text-align: center;
129
+ }
130
+ """
131
+
132
+ with gr.Blocks(css=custom_css, title="๊ธฐํ›„๋ณ€ํ™” ๊ฐ€์งœ๋‰ด์Šค ํŒ๋ณ„๊ธฐ") as demo:
133
+ gr.Markdown("## ๐Ÿ” ๊ธฐํ›„๋ณ€ํ™” ๊ฐ€์งœ๋‰ด์Šค AI ํŒ๋ณ„ ๋ฐ XAI ๋ถ„์„ ์‹œ์Šคํ…œ")
134
+
135
+ with gr.Row():
136
+ with gr.Column(scale=1):
137
+ input_area = gr.Textbox(
138
+ label="๋‰ด์Šค ๊ธฐ์‚ฌ ์ž…๋ ฅ (Preprocess & Tokenize)",
139
+ placeholder="๊ฒ€์ฆํ•  ๊ธฐํ›„๋ณ€ํ™”/๊ณผํ•™ ๊ด€๋ จ ๋‰ด์Šค ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”...",
140
+ lines=8
141
+ )
142
+ btn_analyze = gr.Button("๐Ÿ” ๋ถ„์„ ๋ฐ ํŒ์ • ์‹คํ–‰", variant="primary")
143
+
144
+ with gr.Accordion("๐Ÿ“‹ Model Card ๋ฐ ํ•œ๊ณ„ ๊ณ ์ง€ ์‚ฌํ•ญ ํ™•์ธ", open=False):
145
+ gr.Markdown("""
146
+ - **ํ•™์Šต ๋ฐ์ดํ„ฐ:** 2024~2026๋…„ ๊ธฐํ›„/ํ™˜๊ฒฝ ๊ด€๋ จ ๋‰ด์Šค 200๊ฑด
147
+ - **์ฃผ์š” ํ•œ๊ณ„:**
148
+ 1. ๊ณต์‹ ๋ ฅ ์žˆ๋Š” ๊ธฐ๊ด€ ์œ„์žฅ ์‹œ ์˜คํŒ ๊ฐ€๋Šฅ์„ฑ
149
+ 2. **ํ’์ž/๋ฐ˜์–ด๋ฒ• ํ…์ŠคํŠธ ์ •ํ™•๋„ ๋‚ฎ์Œ**
150
+ 3. ๊ฑฐ์ ˆ ์ •๋ณด ๋ณตํ•ฉ ๋ฌธ๋งฅ์˜ ๊ธฐ๊ณ„ ์˜คํŒ ๊ฐ€๋Šฅ์„ฑ
151
+ - **๊ฐœ๋ฐœ์ž ์ฑ…์ž„ ์„ ์–ธ:** ๋ณธ ๋ชจ๋ธ์˜ ํŒ์ • ๊ฒฐ๊ณผ๋Š” ๋ณด์กฐ ์ง€ํ‘œ์ด๋ฉฐ ์ตœ์ข… ๊ฒฐ์ • ๊ทผ๊ฑฐ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
152
+ """)
153
+
154
+ with gr.Column(scale=1):
155
+ # 1. ํŒ์ • ๊ฒฐ๊ณผ ๋ฐ ๋ชจ๋ธ ํƒœ๊ทธ
156
+ with gr.Row():
157
+ out_verdict = gr.Textbox(label="ํŒ์ •๊ฒฐ๊ณผ", elem_classes=["verdict-box"], interactive=False)
158
+ out_tag = gr.Textbox(label="Model Tag", value="Active Dolphin", interactive=False)
159
+
160
+ # 2. Highlight Word (์–ดํ…์…˜ ๋งต visual)
161
+ out_highlight = gr.HTML(label="Highlight Word")
162
+
163
+ # 3. ์œ„ํ—˜๋„ ์ ์ˆ˜ ๊ฒฐ๊ณผ
164
+ out_risk = gr.Textbox(label="๊ฒฐ๊ณผ", elem_classes=["risk-box"], interactive=False)
165
+
166
+ # 4. ํ•œ๊ณ„ ๊ณ ์ง€ ๊ฒฝ๊ณ  ๋ฌธ๊ตฌ (UI ์Šค์ผ€์น˜ ํ•˜๋‹จ)
167
+ out_disclaimer = gr.Textbox(
168
+ label="ํ•œ๊ณ„ ๊ณ ์ง€ ์•Œ๋ฆผ",
169
+ elem_classes=["disclaimer-box"],
170
+ interactive=False
171
+ )
172
+
173
+ # 5. ์ด์˜ ์ œ๊ธฐ ๋ฒ„ํŠผ ๋ฐ ๋ชจ๋‹ฌ ๋ ˆ์ด์•„์›ƒ
174
+ with gr.Row():
175
+ btn_appeal_open = gr.Button("์ด์˜ ์ œ๊ธฐ", variant="secondary")
176
+
177
+ with gr.Group(visible=False) as appeal_group:
178
+ appeal_input = gr.Textbox(label="์ด์˜ ์ œ๊ธฐ ์‚ฌ์œ  ์ž…๋ ฅ", placeholder="์˜คํŒ์ด๋ผ ์ƒ๊ฐํ•˜๋Š” ์ด์œ ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.")
179
+ btn_appeal_submit = gr.Button("์ œ์ถœํ•˜๊ธฐ")
180
+ appeal_status = gr.Markdown()
181
+
182
+ # ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ์—ฐ๊ฒฐ
183
+ btn_analyze.click(
184
+ fn=run_pipeline,
185
+ inputs=[input_area],
186
+ outputs=[out_verdict, out_tag, out_highlight, out_risk, out_disclaimer]
187
+ )
188
+
189
+ btn_appeal_open.click(
190
+ fn=lambda: gr.update(visible=True),
191
+ inputs=None,
192
+ outputs=[appeal_group]
193
+ )
194
+
195
+ btn_appeal_submit.click(
196
+ fn=submit_appeal,
197
+ inputs=[appeal_input],
198
+ outputs=[appeal_status]
199
+ )
200
+
201
+ if __name__ == "__main__":
202
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ gradio==4.19.2
2
+ transformers==4.38.2
3
+ peft==0.9.0
4
+ accelerate==0.27.2
5
+ huggingface_hub==0.21.4
6
+ torch
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "do_lower_case": false,
5
+ "is_local": false,
6
+ "local_files_only": false,
7
+ "mask_token": "[MASK]",
8
+ "model_max_length": 512,
9
+ "pad_token": "[PAD]",
10
+ "sep_token": "[SEP]",
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "BertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }