xzyao commited on
Commit
40403b0
1 Parent(s): 0a53800

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
  import streamlit as st
4
  import requests
5
  import time
@@ -7,7 +5,8 @@ from ast import literal_eval
7
  from datetime import datetime
8
 
9
  def to_md(text):
10
- return text.replace("\n", "<br />")
 
11
 
12
  @st.cache
13
  def infer(
@@ -35,7 +34,7 @@ def infer(
35
  assert 1 <= num_completions <= 5
36
  assert 0.0 <= temperature <= 10.0
37
  assert 0.0 <= top_p <= 1.0
38
-
39
  if temperature == 0.0:
40
  temperature = 0.01
41
 
@@ -164,7 +163,8 @@ def main():
164
  prompt, model_name=model_name, max_new_tokens=max_new_tokens, temperature=temperature, top_p=top_p, top_k=top_k,
165
  num_completions=num_completions, seed=seed, stop=literal_eval("'''"+stop+"'''"),
166
  )
167
- generated_area.markdown("<b>" + to_md(prompt) + "</b>" + to_md(report_text), unsafe_allow_html=True)
 
168
 
169
  if __name__ == '__main__':
170
  main()
 
 
 
1
  import streamlit as st
2
  import requests
3
  import time
 
5
  from datetime import datetime
6
 
7
  def to_md(text):
8
+ # return text.replace("\n", "<br />")
9
+ return text
10
 
11
  @st.cache
12
  def infer(
 
34
  assert 1 <= num_completions <= 5
35
  assert 0.0 <= temperature <= 10.0
36
  assert 0.0 <= top_p <= 1.0
37
+
38
  if temperature == 0.0:
39
  temperature = 0.01
40
 
 
163
  prompt, model_name=model_name, max_new_tokens=max_new_tokens, temperature=temperature, top_p=top_p, top_k=top_k,
164
  num_completions=num_completions, seed=seed, stop=literal_eval("'''"+stop+"'''"),
165
  )
166
+ print(report_text)
167
+ generated_area.markdown("<b>" + to_md(prompt) + "</b><mark style='background-color: #cbeacd'>" + to_md(report_text)+"</mark>", unsafe_allow_html=True)
168
 
169
  if __name__ == '__main__':
170
  main()