davidkim205 commited on
Commit
1340340
·
verified ·
1 Parent(s): 7450210

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -12
app.py CHANGED
@@ -37,15 +37,18 @@ def respond(
37
 
38
 
39
  def main():
40
- description_text = """
41
- </br><span style="font-size: 22px;">Use <strong>KGrammar</strong>, an offline-ready evaluation framework for Korean AI models, to detect grammatical errors in an LLM-generated response. KGrammar focuses solely on identifying errors, including foreign language usage, without assessing response accuracy or usefulness. Submit the inputs to obtain the grammar evaluation results.</span></br></br>
42
- <span style="font-size: 22px;">1️⃣ <strong>User Message</strong>: Input the LLM-generated response to be evaluated.</span> </br>
43
- <span style="font-size: 22px;">2️⃣ <strong>System Message</strong>: Provide the prompt used for grammar evaluation.</span> </br>
44
- <span style="font-size: 22px;">3️⃣ <strong>Model Selection</strong>: Choose a KGrammar model for assessment.</span> </br>
45
- <span style="font-size: 22px;">4️⃣ <strong>Max New Tokens</strong>: Set the maximum number of tokens for the evaluation output.</span> </br>
46
- <span style="font-size: 22px;">5️⃣ <strong>Temperature</strong>: Adjust the temperature to balance predictability and creativity in KGrammar’s evaluation.</span> </br>
47
- <span style="font-size: 22px;">6️⃣ <strong>Top-p (Nucleus Sampling)</strong>: Modify the top-p value to control fluency and diversity in the evaluation output.</span> </br></br>
48
- <span style="font-size: 22px;"><a href="https://huggingface.co/davidkim205/kgrammar-2-9b" target="_blank" style="text-decoration: none; color: #000080;">Kgrammar model link << Click here!</a></span> </br></br>
 
 
 
49
  """
50
 
51
  examples_list = [["우선, 성인 티켓의 가격은 $4입니다. 총 판매된 티켓 수는 59장이며, 학생 티켓은 9장입니다. 我们需要计算学生票价。성인 티켓은 50장이 판매되었으므로, 성인 티켓으로 얻은 수익은 50 * 4 = $200입니다. Total revenue是 $222.50, 所以学生票的收入为 $222.50 - $200 = $22.50。俄语로 说, 每张学生票的价格 = $22.50 ÷ 9 = $2.50。학생 티켓의 가격은 2.5ดอลล่าครับ.", "한국어 문맥상 부자연스러운 부분을 찾으시오. 오류 문장과 개수는 <incorrect grammar> </incorrect grammar> tag, 즉 <incorrect grammar> - 오류 문장과 설명 </incorrect grammar> 안에 담겨 있으며, <wrong count> </wrong count> tag, 즉 <wrong count> 오류 개수 </wrong count> 이다.", None, None, None, None],
@@ -54,8 +57,13 @@ def main():
54
  ]
55
 
56
  with gr.Blocks() as app:
57
- gr.Markdown("# Checking Korean Grammar Accuracy with KGrammar")
58
- gr.Markdown(description_text)
 
 
 
 
 
59
 
60
  gr.HTML("""<style>
61
  #submit-btn {
@@ -72,7 +80,7 @@ def main():
72
  </style>
73
  """)
74
 
75
- gr.Markdown("## Try it out!")
76
  with gr.Row():
77
  with gr.Column(scale=1):
78
  text1 = gr.Textbox(label="User Message")
 
37
 
38
 
39
  def main():
40
+ description_text1 = """
41
+ </br><span style="font-size: 23px;">The kgrammar model is a state-of-the-art language assessment model designed to evaluate Korean sentences, specifically focusing on detecting instances where a response deviates by incorporating foreign languages or mixing multiple languages within a sentence.</span></br>
42
+ <span style="font-size: 23px;">Built on the Gemma-2-9B architecture, kgrammar aims to ensure language consistency and clarity in Korean text, making it a valuable tool for assessing and refining language models that generate Korean responses.</span> </br></br>
43
+ """
44
+
45
+ description_text2 = """
46
+ </br><span style="font-size: 23px;">The kgrammar-testset was created to train and validate the kgrammar model. This dataset was generated using GPT-4o, incorporating predefined prompts designed to introduce grammatical errors into responses when a question was given.</span></br>
47
+ <span style="font-size: 23px;">To ensure a balanced distribution, the dataset consists of 50% general questions, 25% math-related questions, 25% coding-related questions. This structure helps prevent mathematical expressions and code from being mistakenly identified as language errors.</span> </br></br>
48
+ """
49
+
50
+ description_text3 = """
51
+ </br><span style="font-size: 23px;">kgrammar currently has the following versions available: kgrammar-2-1b, kgrammar-2-3b.</span></br></br>
52
  """
53
 
54
  examples_list = [["우선, 성인 티켓의 가격은 $4입니다. 총 판매된 티켓 수는 59장이며, 학생 티켓은 9장입니다. 我们需要计算学生票价。성인 티켓은 50장이 판매되었으므로, 성인 티켓으로 얻은 수익은 50 * 4 = $200입니다. Total revenue是 $222.50, 所以学生票的收入为 $222.50 - $200 = $22.50。俄语로 说, 每张学生票的价格 = $22.50 ÷ 9 = $2.50。학생 티켓의 가격은 2.5ดอลล่าครับ.", "한국어 문맥상 부자연스러운 부분을 찾으시오. 오류 문장과 개수는 <incorrect grammar> </incorrect grammar> tag, 즉 <incorrect grammar> - 오류 문장과 설명 </incorrect grammar> 안에 담겨 있으며, <wrong count> </wrong count> tag, 즉 <wrong count> 오류 개수 </wrong count> 이다.", None, None, None, None],
 
57
  ]
58
 
59
  with gr.Blocks() as app:
60
+ gr.Markdown("# 🤖 Checking Korean Grammar Accuracy with kgrammar")
61
+ gr.Markdown("## What Is kgrammar?")
62
+ gr.Markdown(description_text1)
63
+ gr.Markdown("## kgrammar Dataset")
64
+ gr.Markdown(description_text2)
65
+ gr.Markdown("## Available kgrammar Models")
66
+ gr.Markdown(description_text3)
67
 
68
  gr.HTML("""<style>
69
  #submit-btn {
 
80
  </style>
81
  """)
82
 
83
+ gr.Markdown("## 🖱️ Try it out!")
84
  with gr.Row():
85
  with gr.Column(scale=1):
86
  text1 = gr.Textbox(label="User Message")