freemt commited on
Commit
70f5c39
·
1 Parent(s): 58eec4c

Remove text1, text2, thresh from ifn

Browse files
Files changed (1) hide show
  1. ubee/__main__.py +4 -68
ubee/__main__.py CHANGED
@@ -75,10 +75,11 @@ except Exception as _:
75
  # 'scores': [0.8885253667831421, 0.10581762343645096, 0.005657028406858444]}
76
  # Runs OK
77
 
78
- text1= ""
79
  text2 = ""
80
  thresh: float = 0.4
81
 
 
82
  # segment: str
83
  def ifn(
84
  # text1,
@@ -121,6 +122,8 @@ def ifn(
121
 
122
  def main():
123
  """Create main entry."""
 
 
124
  text_zh = Path("data/test_zh.txt").read_text(encoding="utf8")
125
  text_zh = [elm.strip() for elm in text_zh.splitlines() if elm.strip()][:10]
126
  text_zh = "\n\n".join(text_zh)
@@ -180,73 +183,6 @@ def main():
180
  lines = 15
181
  placeholder = "Type or paste text here"
182
 
183
- inputs = [
184
- gr.inputs.Textbox(
185
- lines=lines, placeholder=placeholder, default=ex2_zh, label="text1"
186
- ),
187
- gr.inputs.Textbox(
188
- lines=lines, placeholder=placeholder, default=ex2_en, label="text2"
189
- ),
190
- gr.inputs.Slider(
191
- minimum=0.0,
192
- maximum=1.0,
193
- step=0.1,
194
- default=0.4,
195
- label="threshold",
196
- ),
197
- ]
198
-
199
- out_df = gr.outputs.Dataframe(
200
- headers=None,
201
- max_rows=lines, # 20
202
- max_cols=None,
203
- overflow_row_behaviour="paginate",
204
- type="auto",
205
- label="To be aligned",
206
- )
207
- aligned = gr.outputs.Dataframe(
208
- headers=None,
209
- max_rows=lines, # 20
210
- max_cols=None,
211
- overflow_row_behaviour="paginate",
212
- type="auto",
213
- label="Aligned",
214
- )
215
- leftover = gr.outputs.Dataframe(
216
- headers=None,
217
- max_rows=lines, # 20
218
- max_cols=None,
219
- overflow_row_behaviour="paginate",
220
- type="auto",
221
- label="Leftover",
222
- )
223
- outputs = [ # tot. 3
224
- out_df,
225
- aligned,
226
- leftover,
227
- ]
228
-
229
- _ = """ # switch to blocks
230
- iface = gr.Interface(
231
- fn=greet,
232
- # fn=ubee,
233
- title=title,
234
- theme=theme,
235
- layout="vertical", # horizontal unaligned
236
- description=description,
237
- article=article,
238
- # inputs="text",
239
- # outputs="text",
240
- inputs=inputs, # text1, text2, segment, thresh
241
- outputs=outputs,
242
- examples=examples,
243
- # enable_queue=True,
244
- )
245
- iface.launch(
246
- enable_queue=True,
247
- share=True,
248
- )
249
- # """
250
  blocks = gr.Blocks()
251
 
252
  with blocks:
 
75
  # 'scores': [0.8885253667831421, 0.10581762343645096, 0.005657028406858444]}
76
  # Runs OK
77
 
78
+ text1 = ""
79
  text2 = ""
80
  thresh: float = 0.4
81
 
82
+
83
  # segment: str
84
  def ifn(
85
  # text1,
 
122
 
123
  def main():
124
  """Create main entry."""
125
+ global text1, text2, threash
126
+
127
  text_zh = Path("data/test_zh.txt").read_text(encoding="utf8")
128
  text_zh = [elm.strip() for elm in text_zh.splitlines() if elm.strip()][:10]
129
  text_zh = "\n\n".join(text_zh)
 
183
  lines = 15
184
  placeholder = "Type or paste text here"
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  blocks = gr.Blocks()
187
 
188
  with blocks: