Spaces:
Runtime error
Runtime error
add memory information
Browse files- app/app.py +4 -1
- requirements.txt +2 -1
app/app.py
CHANGED
|
@@ -6,8 +6,9 @@ import random
|
|
| 6 |
import time
|
| 7 |
from transformers import pipeline, set_seed
|
| 8 |
import tokenizers
|
|
|
|
| 9 |
|
| 10 |
-
# st.set_page_config(page_title="
|
| 11 |
|
| 12 |
# vector_length = 128
|
| 13 |
model_name = "cahya/gpt2-small-indonesian-story"
|
|
@@ -102,6 +103,7 @@ seed = st.sidebar.number_input(
|
|
| 102 |
text_generator = get_generator()
|
| 103 |
if st.button("Run"):
|
| 104 |
with st.spinner(text="Getting results..."):
|
|
|
|
| 105 |
st.subheader("Result")
|
| 106 |
time_start = time.time()
|
| 107 |
result = process(text=session_state.text, max_length=int(max_length),
|
|
@@ -115,6 +117,7 @@ if st.button("Run"):
|
|
| 115 |
translation = translate(result, "en", "id")
|
| 116 |
st.write(translation.replace("\n", " \n"))
|
| 117 |
# st.write(f"*do_sample: {do_sample}, top_k: {top_k}, top_p: {top_p}, seed: {seed}*")
|
|
|
|
| 118 |
st.write(f"*Text generated in {time_diff:.5} seconds*")
|
| 119 |
|
| 120 |
# Reset state
|
|
|
|
| 6 |
import time
|
| 7 |
from transformers import pipeline, set_seed
|
| 8 |
import tokenizers
|
| 9 |
+
import psutil
|
| 10 |
|
| 11 |
+
# st.set_page_config(page_title="Indonesian Story Generator")
|
| 12 |
|
| 13 |
# vector_length = 128
|
| 14 |
model_name = "cahya/gpt2-small-indonesian-story"
|
|
|
|
| 103 |
text_generator = get_generator()
|
| 104 |
if st.button("Run"):
|
| 105 |
with st.spinner(text="Getting results..."):
|
| 106 |
+
memory = psutil.virtual_memory()
|
| 107 |
st.subheader("Result")
|
| 108 |
time_start = time.time()
|
| 109 |
result = process(text=session_state.text, max_length=int(max_length),
|
|
|
|
| 117 |
translation = translate(result, "en", "id")
|
| 118 |
st.write(translation.replace("\n", " \n"))
|
| 119 |
# st.write(f"*do_sample: {do_sample}, top_k: {top_k}, top_p: {top_p}, seed: {seed}*")
|
| 120 |
+
st.write(f"*Memory: {memory}*")
|
| 121 |
st.write(f"*Text generated in {time_diff:.5} seconds*")
|
| 122 |
|
| 123 |
# Reset state
|
requirements.txt
CHANGED
|
@@ -6,4 +6,5 @@ datasets
|
|
| 6 |
mtranslate
|
| 7 |
# streamlit version 0.67.1 is needed due to issue with caching
|
| 8 |
# streamlit==0.67.1
|
| 9 |
-
streamlit
|
|
|
|
|
|
| 6 |
mtranslate
|
| 7 |
# streamlit version 0.67.1 is needed due to issue with caching
|
| 8 |
# streamlit==0.67.1
|
| 9 |
+
streamlit
|
| 10 |
+
psutil
|