Spaces:
Runtime error
Runtime error
Ubuntu
commited on
Commit
·
c694998
1
Parent(s):
df71374
update
Browse files
app.py
CHANGED
|
@@ -3,6 +3,8 @@ import requests
|
|
| 3 |
import time
|
| 4 |
from ast import literal_eval
|
| 5 |
|
|
|
|
|
|
|
| 6 |
|
| 7 |
@st.cache
|
| 8 |
def infer(
|
|
@@ -149,17 +151,17 @@ def main():
|
|
| 149 |
)
|
| 150 |
|
| 151 |
generated_area = st.empty()
|
| 152 |
-
generated_area.
|
| 153 |
|
| 154 |
button_submit = st.button("Submit")
|
| 155 |
|
| 156 |
if button_submit:
|
| 157 |
-
generated_area.
|
| 158 |
report_text = infer(
|
| 159 |
prompt, model_name=model_name, max_new_tokens=max_new_tokens, temperature=temperature, top_p=top_p, top_k=top_k,
|
| 160 |
num_completions=num_completions, seed=seed, stop=literal_eval("'''"+stop+"'''"),
|
| 161 |
)
|
| 162 |
-
generated_area.
|
| 163 |
|
| 164 |
if __name__ == '__main__':
|
| 165 |
main()
|
|
|
|
| 3 |
import time
|
| 4 |
from ast import literal_eval
|
| 5 |
|
| 6 |
+
def to_md(text):
|
| 7 |
+
return text.replace("\n", "<br />")
|
| 8 |
|
| 9 |
@st.cache
|
| 10 |
def infer(
|
|
|
|
| 151 |
)
|
| 152 |
|
| 153 |
generated_area = st.empty()
|
| 154 |
+
generated_area.markdown("(Generate here)")
|
| 155 |
|
| 156 |
button_submit = st.button("Submit")
|
| 157 |
|
| 158 |
if button_submit:
|
| 159 |
+
generated_area.markdown("<b>" + to_md(prompt) + "</b>", unsafe_allow_html=True)
|
| 160 |
report_text = infer(
|
| 161 |
prompt, model_name=model_name, max_new_tokens=max_new_tokens, temperature=temperature, top_p=top_p, top_k=top_k,
|
| 162 |
num_completions=num_completions, seed=seed, stop=literal_eval("'''"+stop+"'''"),
|
| 163 |
)
|
| 164 |
+
generated_area.markdown("<b>" + to_md(prompt) + "</b>" + to_md(report_text), unsafe_allow_html=True)
|
| 165 |
|
| 166 |
if __name__ == '__main__':
|
| 167 |
main()
|