Upload streamapp.py
Browse files- streamapp.py +22 -1
streamapp.py
CHANGED
|
@@ -3,6 +3,9 @@ import json
|
|
| 3 |
import pandas as pd
|
| 4 |
import time
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
#from hallucinator import HallucinatonEvaluater
|
| 7 |
|
| 8 |
from langchain.embeddings import HuggingFaceEmbeddings #for using HugginFace models
|
|
@@ -29,8 +32,17 @@ import pandas as pd
|
|
| 29 |
# from sklearn import datasets
|
| 30 |
# from sklearn.ensemble import RandomForestClassifier
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
|
|
@@ -253,7 +265,16 @@ with tab2:
|
|
| 253 |
|
| 254 |
|
| 255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
|
|
|
|
| 257 |
|
| 258 |
|
| 259 |
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import time
|
| 5 |
|
| 6 |
+
import phoenix as px
|
| 7 |
+
from phoenix.trace.langchain import OpenInferenceTracer, LangChainInstrumentor
|
| 8 |
+
|
| 9 |
#from hallucinator import HallucinatonEvaluater
|
| 10 |
|
| 11 |
from langchain.embeddings import HuggingFaceEmbeddings #for using HugginFace models
|
|
|
|
| 32 |
# from sklearn import datasets
|
| 33 |
# from sklearn.ensemble import RandomForestClassifier
|
| 34 |
|
| 35 |
+
#phoenix setup
|
| 36 |
+
session = px.launch_app()
|
| 37 |
+
# If no exporter is specified, the tracer will export to the locally running Phoenix server
|
| 38 |
+
tracer = OpenInferenceTracer()
|
| 39 |
+
# If no tracer is specified, a tracer is constructed for you
|
| 40 |
+
LangChainInstrumentor(tracer).instrument()
|
| 41 |
+
print(session.url)
|
| 42 |
+
|
| 43 |
|
| 44 |
+
|
| 45 |
+
tab1, tab2, tab3 = st.tabs(["π RAG", "π FactVsHallucinate" , "trace"])
|
| 46 |
|
| 47 |
|
| 48 |
|
|
|
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
+
with tab3:
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
with st.form(" trace"):
|
| 273 |
+
|
| 274 |
+
df = px.active_session().get_spans_dataframe().fillna('')
|
| 275 |
+
st.dataframe(df)
|
| 276 |
|
| 277 |
+
|
| 278 |
|
| 279 |
|
| 280 |
|