File size: 1,236 Bytes
dbf7be3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import evaluate
from evaluate.utils import launch_gradio_widget
# import re 

# match = re.match(
#                 r"^from\s+(\.?)([^\s\.]+)(?:[^\s]*)\s+import\s+[^#\r\n]*(?:#\s+From:\s+)?([^\r\n]*)",
#                 "from .bleu import bleu",
#                 flags=re.MULTILINE,
#             )
# match = re.match(r"^import\s+(\.?)([^\s\.]+)[^#\r\n]*(?:#\s+From:\s+)?([^\r\n]*)", "import .bleu", flags=re.MULTILINE)

# print(match)
module = evaluate.load("dvitel/codebleu")
launch_gradio_widget(module)
# src = 'class AcidicSwampOoze(MinionCard):Β§    def __init__(self):Β§        super().__init__("Acidic Swamp Ooze", 2, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON, battlecry=Battlecry(Destroy(), WeaponSelector(EnemyPlayer())))Β§Β§    def create_minion(self, player):Β§        return Minion(3, 2)Β§'
# tgt = 'class AcidSwampOoze(MinionCard):Β§    def __init__(self):Β§        super().__init__("Acidic Swamp Ooze", 2, CHARACTER_CLASS.ALL, CARD_RARITY.COMMON, battlecry=Battlecry(Destroy(), WeaponSelector(EnemyPlayer())))Β§Β§    def create_minion(self, player):Β§        return Minion(3, 2)Β§'
# src = src.replace("Β§","\n")
# tgt = tgt.replace("Β§","\n")
# res = module.compute(predictions = [tgt], references = [[src]])
# print(res)