Urdatorn commited on
Commit
da2df3c
·
1 Parent(s): 0b6208b

example fix

Browse files
Files changed (3) hide show
  1. apitest.py +1 -0
  2. app.py +20 -0
  3. tests/test_markup.py +11 -0
apitest.py CHANGED
@@ -4,5 +4,6 @@ client = Client("al1808th/macronizer")
4
  result = client.predict(
5
  text="ἀάατος",
6
  model_label="mega",
 
7
  )
8
  print(result)
 
4
  result = client.predict(
5
  text="ἀάατος",
6
  model_label="mega",
7
+ api_name="/render_results",
8
  )
9
  print(result)
app.py CHANGED
@@ -564,8 +564,28 @@ CSS = """
564
  padding: 0.9rem;
565
  }
566
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  #try-examples .example-text {
 
568
  white-space: pre-wrap;
 
 
 
569
  }
570
 
571
  .legend {
 
564
  padding: 0.9rem;
565
  }
566
 
567
+ #try-examples .examples {
568
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
569
+ align-items: stretch;
570
+ max-width: 100%;
571
+ }
572
+
573
+ #try-examples .example {
574
+ min-height: 0;
575
+ height: auto;
576
+ }
577
+
578
+ #try-examples .example-content,
579
+ #try-examples .example-text-content {
580
+ width: 100%;
581
+ }
582
+
583
  #try-examples .example-text {
584
+ display: block;
585
  white-space: pre-wrap;
586
+ overflow: visible;
587
+ text-overflow: clip;
588
+ line-height: 1.35;
589
  }
590
 
591
  .legend {
tests/test_markup.py CHANGED
@@ -235,6 +235,17 @@ def test_public_api_text_example_is_greek():
235
  assert api_text_components[0]["props"]["value"] == "ἀάατος"
236
 
237
 
 
 
 
 
 
 
 
 
 
 
 
238
  def test_python_api_instructions_omit_api_name():
239
  import app
240
 
 
235
  assert api_text_components[0]["props"]["value"] == "ἀάατος"
236
 
237
 
238
+ def test_try_examples_preserve_visible_line_breaks():
239
+ import app
240
+
241
+ assert all("\n" in example for example in app.examples)
242
+ assert "#try-examples .examples" in app.CSS
243
+ assert "#try-examples .example-text" in app.CSS
244
+ assert "white-space: pre-wrap" in app.CSS
245
+ assert "overflow: visible" in app.CSS
246
+ assert "text-overflow: clip" in app.CSS
247
+
248
+
249
  def test_python_api_instructions_omit_api_name():
250
  import app
251