TIMAX-159 commited on
Commit
5668b25
1 Parent(s): 93d86b7

instruction

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +8 -5
  3. description.md +28 -0
README.md CHANGED
@@ -11,7 +11,7 @@ pinned: true
11
 
12
  ## :hand: Intro
13
 
14
- This is a simple string replacement program dedicated for typing logic symbols. Since those symbols are not on our keyboard, typing them is a little bit cumbersome. This tool allows you to type English to get them. Have fun!
15
 
16
  > Permalink: https://huggingface.co/spaces/TIMAX/Logic-Translator
17
 
 
11
 
12
  ## :hand: Intro
13
 
14
+ Type English for logic symbols! This is a simple string replacement program dedicated for typing logic symbols. Since those symbols are not on our keyboard, typing them is a little bit cumbersome. This tool allows you to type English to get them. Have fun!
15
 
16
  > Permalink: https://huggingface.co/spaces/TIMAX/Logic-Translator
17
 
app.py CHANGED
@@ -1,4 +1,8 @@
1
  import gradio as gr
 
 
 
 
2
 
3
 
4
  logic_dict = {
@@ -20,8 +24,8 @@ def logic(string: str):
20
  return processed_string
21
 
22
 
23
- demo = gr.Interface(fn=logic,
24
- inputs="text", outputs="text",
25
  examples=[
26
  'ALLx (Student(x) IMPLY Smart(x))',
27
  'EXISTx (TShirt(x) AND Buy(adam, x))',
@@ -30,8 +34,7 @@ demo = gr.Interface(fn=logic,
30
  'ALLx (Project(x) IMPLY (WrittenIn(x, python) XR WrittenIn(x, c++)))'
31
  ],
32
  title="Logic Translator",
33
- description="Type English for logic symbols!\n∧:AND, ∨:OR, ¬:NOT, ⊕:XR, →:IMPLY, ↔:EQUIV, ∀:ALL, ∃:EXIST (you can input multi-line sentences)",
34
  live=True)
35
 
36
- demo.launch()
37
-
 
1
  import gradio as gr
2
+ from pathlib import Path
3
+
4
+
5
+ DESCRIPTION = Path("description.md").read_text(encoding='utf-8')
6
 
7
 
8
  logic_dict = {
 
24
  return processed_string
25
 
26
 
27
+ demo = gr.Interface(fn=logic,
28
+ inputs="text", outputs="text",
29
  examples=[
30
  'ALLx (Student(x) IMPLY Smart(x))',
31
  'EXISTx (TShirt(x) AND Buy(adam, x))',
 
34
  'ALLx (Project(x) IMPLY (WrittenIn(x, python) XR WrittenIn(x, c++)))'
35
  ],
36
  title="Logic Translator",
37
+ description=DESCRIPTION,
38
  live=True)
39
 
40
+ demo.launch(share=True)
 
description.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Intro
2
+
3
+ Type English for logic symbols! This is a simple string replacement program dedicated for typing logic symbols. Since those symbols are not on our keyboard, typing them is a little cumbersome. This tool allows you to type English to get them. Have fun!
4
+
5
+ ## Usage
6
+
7
+ ### Steps
8
+
9
+ * Input your FOL sentence in the box of **string**. If you want to type a specific logic symbol at some point of your FOL sentence, just type its corresponding tag (uppercase English words) instead, and keep everything else the same. You will find the translation and five examples below.
10
+ * The translation is **real-time**. The result would be shown in the box of **output**.
11
+ * Just copy the result for your need!
12
+
13
+ ### Notice
14
+
15
+ * Note that you can input **multi-line** sentences!
16
+ * Please don’t include the exact same uppercase spelling of any of the tags in your FOL sentence if you don’t mean it, or the program will replace them without thinking. For example, it your input sentence is: **WALL(berlin wall)** meaning “berlin wall is a wall”, the program output would be **W∀(berlin wall)** with the **ALL** after **W** replaced by **∀**, which is not what you want.
17
+
18
+ # Translation
19
+ | Logic Symbol | Tag |
20
+ | :----------: | :---: |
21
+ | ∧ | AND |
22
+ | ∨ | OR |
23
+ | ¬ | NOT |
24
+ | ⊕ | XR |
25
+ | → | IMPLY |
26
+ | ↔ | EQUIV |
27
+ | ∀ | ALL |
28
+ | ∃ | EXIST |