FremyCompany commited on
Commit
f22721a
Β·
verified Β·
1 Parent(s): 9d8e26e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  st.set_page_config(layout="wide")
3
 
4
- DEBUG = False
5
  if DEBUG:
6
  # Use some dummy data
7
  tokens = [
@@ -70,21 +70,26 @@ else:
70
  # Simplify the tokens for display
71
  tokens = [[token[3:].replace("\u2581", " ") for token in sentence] for sentence in tokens]
72
 
73
- st.html(f"""
74
-
75
  <article>
76
- <div>{("βœ… Congrats!" if sentence_similarity >= 0.65 else "❌ Sorry!")} These sentences have {100*sentence_similarity}% similarity.
 
 
77
  </div>
78
- <p id="sent0">
79
- {"".join([f'{' ' if token[0] == ' ' else ''}<span>{token[1:] if token[0] == ' ' else token}</span>' for token in tokens[0]])}
 
 
80
  </p>
81
- <p id="sent1">
82
- {"".join([f'{' ' if token[0] == ' ' else ''}<span>{token[1:] if token[0] == ' ' else token}</span>' for token in tokens[1]])}
 
 
83
  </p>
84
- </article>
85
- f""")
86
 
87
- html = """
88
  <style>
89
  article {
90
  font-family: sans-serif;
 
1
  import streamlit as st
2
  st.set_page_config(layout="wide")
3
 
4
+ DEBUG = True
5
  if DEBUG:
6
  # Use some dummy data
7
  tokens = [
 
70
  # Simplify the tokens for display
71
  tokens = [[token[3:].replace("\u2581", " ") for token in sentence] for sentence in tokens]
72
 
73
+ html = ''
74
+ html += """
75
  <article>
76
+ <div>"""
77
+ html += f"""{("βœ… Congrats!" if sentence_similarity >= 0.65 else "❌ Sorry!")} These sentences have {100*sentence_similarity}% similarity."""
78
+ html += """
79
  </div>
80
+ <p id="sent0">"""
81
+ for token in tokens[0]:
82
+ html += f"""{' ' if token[0] == ' ' else ''}<span>{token[1:] if token[0] == ' ' else token}</span>"""
83
+ html += """</div>
84
  </p>
85
+ <p id="sent1">"""
86
+ for token in tokens[1]:
87
+ html += f"""{' ' if token[0] == ' ' else ''}<span>{token[1:] if token[0] == ' ' else token}</span>"""
88
+ html += """</div>
89
  </p>
90
+ </article>"""
 
91
 
92
+ html += """
93
  <style>
94
  article {
95
  font-family: sans-serif;