Spaces:
Runtime error
Runtime error
| 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) |