Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -183,14 +183,14 @@ if uploaded_file:
|
|
| 183 |
f.write(uploaded_file.getvalue())
|
| 184 |
t_end1 = time()
|
| 185 |
log.append(f"π File Upload & Save Time: {t_end1 - t_start1:.2f} s")
|
| 186 |
-
|
| 187 |
|
| 188 |
# PART 2: Document and Cache Load
|
| 189 |
t_start2 = time()
|
| 190 |
cache, doc_text,doc_text_count, model, tokenizer = load_document_and_cache(temp_file_path)
|
| 191 |
t_end2 = time()
|
| 192 |
log.append(f"π Document & Cache Load Time: {t_end2 - t_start2:.2f} s")
|
| 193 |
-
|
| 194 |
|
| 195 |
# PART 3: Document Preview Display
|
| 196 |
t_start3 = time()
|
|
@@ -199,13 +199,13 @@ if uploaded_file:
|
|
| 199 |
st.text(preview)
|
| 200 |
t_end3 = time()
|
| 201 |
log.append(f"π Document Preview Display Time: {t_end3 - t_start3:.2f} s")
|
| 202 |
-
|
| 203 |
t_start4 = time()
|
| 204 |
# PART 4: Show Basic Info
|
| 205 |
s_cache=calculate_cache_size(cache)
|
| 206 |
t_end4 = time()
|
| 207 |
log.append(f"π doc_size_kb Preview Display Time: {t_end4 - t_start4:.2f} s")
|
| 208 |
-
|
| 209 |
#st.info(
|
| 210 |
# f"Document Chars: {len(doc_text)} | Size: {doc_size_kb:.2f} KB | "
|
| 211 |
# f"Cache Size: {cache_size if cache_size == 'N/A' else f'{cache_size:.2f} KB'}"
|
|
@@ -258,10 +258,10 @@ if uploaded_file:
|
|
| 258 |
st.write(response)
|
| 259 |
print(f"***************************************************************************************")
|
| 260 |
# Final Info Display
|
| 261 |
-
|
| 262 |
# f"Document Chars: {len(doc_text)} | Size: {doc_size_kb:.2f} KB | "
|
| 263 |
-
|
| 264 |
-
|
| 265 |
|
| 266 |
# =========================
|
| 267 |
# Show Log
|
|
|
|
| 183 |
f.write(uploaded_file.getvalue())
|
| 184 |
t_end1 = time()
|
| 185 |
log.append(f"π File Upload & Save Time: {t_end1 - t_start1:.2f} s")
|
| 186 |
+
# print(f"π File Upload & Save Time: {t_end1 - t_start1:.2f} s")
|
| 187 |
|
| 188 |
# PART 2: Document and Cache Load
|
| 189 |
t_start2 = time()
|
| 190 |
cache, doc_text,doc_text_count, model, tokenizer = load_document_and_cache(temp_file_path)
|
| 191 |
t_end2 = time()
|
| 192 |
log.append(f"π Document & Cache Load Time: {t_end2 - t_start2:.2f} s")
|
| 193 |
+
# print(f"π Document & Cache Load Time: {t_end2 - t_start2:.2f} s")
|
| 194 |
|
| 195 |
# PART 3: Document Preview Display
|
| 196 |
t_start3 = time()
|
|
|
|
| 199 |
st.text(preview)
|
| 200 |
t_end3 = time()
|
| 201 |
log.append(f"π Document Preview Display Time: {t_end3 - t_start3:.2f} s")
|
| 202 |
+
# print(f"π Document Preview Display Time: {t_end3 - t_start3:.2f} s")
|
| 203 |
t_start4 = time()
|
| 204 |
# PART 4: Show Basic Info
|
| 205 |
s_cache=calculate_cache_size(cache)
|
| 206 |
t_end4 = time()
|
| 207 |
log.append(f"π doc_size_kb Preview Display Time: {t_end4 - t_start4:.2f} s")
|
| 208 |
+
# print(f"π doc_size_kb Preview Display Time: {t_end4 - t_start4:.2f} s||||||| size of the cache : {s_cache} MB")
|
| 209 |
#st.info(
|
| 210 |
# f"Document Chars: {len(doc_text)} | Size: {doc_size_kb:.2f} KB | "
|
| 211 |
# f"Cache Size: {cache_size if cache_size == 'N/A' else f'{cache_size:.2f} KB'}"
|
|
|
|
| 258 |
st.write(response)
|
| 259 |
print(f"***************************************************************************************")
|
| 260 |
# Final Info Display
|
| 261 |
+
# st.info(
|
| 262 |
# f"Document Chars: {len(doc_text)} | Size: {doc_size_kb:.2f} KB | "
|
| 263 |
+
# f"Cache Clone Time: {log[-3].split(': ')[1]} | Generation Time: {last_generation_time:.2f} s"
|
| 264 |
+
# )
|
| 265 |
|
| 266 |
# =========================
|
| 267 |
# Show Log
|