TIMAX-159
translator
f9b0cc9
raw
history blame
850 Bytes
import gradio as gr
logic_dict = {
'AND': '∧',
'OR': '∨',
'NOT': 'Β¬',
'IMPLY': 'β†’',
'EQUIV': '↔',
'ALL': 'βˆ€',
'EXIST': 'βˆƒ'
}
def logic(string: str):
for word, symbol in logic_dict.items():
string = string.replace(word, symbol)
return string
demo = gr.Interface(fn=logic,
inputs="text", outputs="text",
examples=[
'ALLx. Student(x) IMPLY Smart(x)',
'EXISTx. TShirt(x) AND Buy(Adam, x)',
'ALLx. Animal(x) AND Fluffy(x) IMPLY Rabbit(x) OR Sheep(x)'
],
title="Logic Translator",
description="∧:AND, ∨:OR, Β¬:NOT, β†’:IMPLY, ↔:EQUIV, βˆ€:ALL, βˆƒ:EXIST",
live=True)
demo.launch(share=True)