Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| logic_dict = { | |
| 'AND': 'β§', | |
| 'OR': 'β¨', | |
| 'NOT': 'Β¬', | |
| 'XR': 'β', | |
| '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))', | |
| '(GoDowntown(James) AND NOTCarry(James, Bag)) EQUIV Buy(James, Book)', | |
| 'ALLx. Project(x) IMPLY (WrittenIn(x, Python) XR WrittenIn(x, C++))' | |
| ], | |
| title="Logic Translator", | |
| description="Type English for logic symbols! \n β§:AND, β¨:OR, Β¬:NOT, β:XR, β:IMPLY, β:EQUIV, β:ALL, β:EXIST", | |
| live=True) | |
| demo.launch(share=True) | |