Spaces:
Runtime error
Runtime error
Add proper profiling reading
Browse files
app.py
CHANGED
|
@@ -35,9 +35,18 @@ def main():
|
|
| 35 |
vector_store = PDF_4_QA(uploaded_file)
|
| 36 |
QA_Bot(vector_store)
|
| 37 |
profiler.disable()
|
| 38 |
-
stats = pstats.Stats(profiler).sort_stats('cumulative')
|
| 39 |
#stats.print_stats()
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
if __name__ == '__main__':
|
|
|
|
| 35 |
vector_store = PDF_4_QA(uploaded_file)
|
| 36 |
QA_Bot(vector_store)
|
| 37 |
profiler.disable()
|
|
|
|
| 38 |
#stats.print_stats()
|
| 39 |
+
s = StringIO()
|
| 40 |
+
ps = pstats.Stats(profiler, stream=s).sort_stats('cumulative')
|
| 41 |
+
|
| 42 |
+
# Print the profiling results to the StringIO object
|
| 43 |
+
ps.print_stats()
|
| 44 |
+
|
| 45 |
+
# Get the profiling results as a string
|
| 46 |
+
profiling_results = s.getvalue()
|
| 47 |
+
|
| 48 |
+
# Print the profiling results
|
| 49 |
+
st.session_state.messages.append({"role": "assistant", "content": profiling_results})
|
| 50 |
|
| 51 |
|
| 52 |
if __name__ == '__main__':
|