admin commited on
Commit
5c1a054
·
1 Parent(s): cc646d3
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -9,9 +9,9 @@ def generate_md(args_dict, name):
9
  ans_latex = solutions[name](**args_dict).get_latex_ans()
10
 
11
  except BadInput as e:
12
- return f"输入错误, 请输入有效的数字: {e}"
13
 
14
- return f"注意到 $${ans_latex}$$ 证毕!"
15
 
16
 
17
  def float_to_fraction(x):
@@ -44,7 +44,7 @@ def float_to_fraction(x):
44
 
45
  def infer_pi(p, q):
46
  if q == 0:
47
- return "分母不能为 0 !"
48
 
49
  p, q = float_to_fraction(p / q)
50
  args_dict = {"p": p, "q": q}
@@ -53,7 +53,7 @@ def infer_pi(p, q):
53
 
54
  def infer_e(p, q):
55
  if q == 0:
56
- return "分母不能为 0 !"
57
 
58
  p, q = float_to_fraction(p / q)
59
  args_dict = {"p": p, "q": q}
@@ -62,7 +62,7 @@ def infer_e(p, q):
62
 
63
  def infer_eq(q1, q2, u, v):
64
  if q2 == 0 or v == 0:
65
- return "分母不能为 0 !"
66
 
67
  q1, q2 = float_to_fraction(q1 / q2)
68
  u, v = float_to_fraction(u / v)
@@ -72,7 +72,7 @@ def infer_eq(q1, q2, u, v):
72
 
73
  def infer_pin(n: int, p, q):
74
  if q == 0:
75
- return "分母不能为 0 !"
76
 
77
  p, q = float_to_fraction(p / q)
78
  args_dict = {"n": n, "p": p, "q": q}
@@ -88,7 +88,7 @@ if __name__ == "__main__":
88
  __import__(f"solutions.{file_name[:-3]}")
89
 
90
  with gr.Blocks() as demo:
91
- gr.Markdown("# “注意到”证明法比较大小")
92
  with gr.Tabs():
93
  with gr.TabItem("π"):
94
  gr.Interface(
@@ -98,12 +98,12 @@ if __name__ == "__main__":
98
  gr.Number(label="q", value=100),
99
  ],
100
  outputs=gr.Markdown(
101
- value="#### 证明结果",
102
  show_copy_button=True,
103
  container=True,
104
  min_height=122,
105
  ),
106
- title="比较 π p/q 大小",
107
  allow_flagging="never",
108
  )
109
 
@@ -115,12 +115,12 @@ if __name__ == "__main__":
115
  gr.Number(label="q", value=1000),
116
  ],
117
  outputs=gr.Markdown(
118
- value="#### 证明结果",
119
  show_copy_button=True,
120
  container=True,
121
  min_height=122,
122
  ),
123
- title="比较 e p/q 大小",
124
  allow_flagging="never",
125
  )
126
 
@@ -134,12 +134,12 @@ if __name__ == "__main__":
134
  gr.Number(label="v", value=1000),
135
  ],
136
  outputs=gr.Markdown(
137
- value="#### 证明结果",
138
  show_copy_button=True,
139
  container=True,
140
  min_height=122,
141
  ),
142
- title="比较 e^(p/q) u/v 大小",
143
  allow_flagging="never",
144
  )
145
 
@@ -152,12 +152,12 @@ if __name__ == "__main__":
152
  gr.Number(label="q", value=1),
153
  ],
154
  outputs=gr.Markdown(
155
- value="#### 证明结果",
156
  show_copy_button=True,
157
  container=True,
158
  min_height=122,
159
  ),
160
- title="比较 π^n p/q 大小",
161
  allow_flagging="never",
162
  )
163
 
 
9
  ans_latex = solutions[name](**args_dict).get_latex_ans()
10
 
11
  except BadInput as e:
12
+ return f"Incorrectly entered. Please enter a valid number: {e}"
13
 
14
+ return f"Note that $${ans_latex}$$ QED"
15
 
16
 
17
  def float_to_fraction(x):
 
44
 
45
  def infer_pi(p, q):
46
  if q == 0:
47
+ return "The denominator can not be 0 !"
48
 
49
  p, q = float_to_fraction(p / q)
50
  args_dict = {"p": p, "q": q}
 
53
 
54
  def infer_e(p, q):
55
  if q == 0:
56
+ return "The denominator can not be 0 !"
57
 
58
  p, q = float_to_fraction(p / q)
59
  args_dict = {"p": p, "q": q}
 
62
 
63
  def infer_eq(q1, q2, u, v):
64
  if q2 == 0 or v == 0:
65
+ return "The denominator can not be 0 !"
66
 
67
  q1, q2 = float_to_fraction(q1 / q2)
68
  u, v = float_to_fraction(u / v)
 
72
 
73
  def infer_pin(n: int, p, q):
74
  if q == 0:
75
+ return "The denominator can not be 0 !"
76
 
77
  p, q = float_to_fraction(p / q)
78
  args_dict = {"n": n, "p": p, "q": q}
 
88
  __import__(f"solutions.{file_name[:-3]}")
89
 
90
  with gr.Blocks() as demo:
91
+ gr.Markdown("# Compare sizes by 'Note that' proof")
92
  with gr.Tabs():
93
  with gr.TabItem("π"):
94
  gr.Interface(
 
98
  gr.Number(label="q", value=100),
99
  ],
100
  outputs=gr.Markdown(
101
+ value="#### Proof result",
102
  show_copy_button=True,
103
  container=True,
104
  min_height=122,
105
  ),
106
+ title="Compare π and p/q",
107
  allow_flagging="never",
108
  )
109
 
 
115
  gr.Number(label="q", value=1000),
116
  ],
117
  outputs=gr.Markdown(
118
+ value="#### Proof result",
119
  show_copy_button=True,
120
  container=True,
121
  min_height=122,
122
  ),
123
+ title="Compare e and p/q",
124
  allow_flagging="never",
125
  )
126
 
 
134
  gr.Number(label="v", value=1000),
135
  ],
136
  outputs=gr.Markdown(
137
+ value="#### Proof result",
138
  show_copy_button=True,
139
  container=True,
140
  min_height=122,
141
  ),
142
+ title="Compare e^(p/q) and u/v",
143
  allow_flagging="never",
144
  )
145
 
 
152
  gr.Number(label="q", value=1),
153
  ],
154
  outputs=gr.Markdown(
155
+ value="#### Proof result",
156
  show_copy_button=True,
157
  container=True,
158
  min_height=122,
159
  ),
160
+ title="Compare π^n and p/q",
161
  allow_flagging="never",
162
  )
163