Update functions.py
Browse files- functions.py +8 -0
functions.py
CHANGED
|
@@ -54,6 +54,10 @@ from langchain.schema import (
|
|
| 54 |
|
| 55 |
from langchain.prompts import PromptTemplate
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
nltk.download('punkt')
|
| 58 |
|
| 59 |
|
|
@@ -309,6 +313,10 @@ def inference(link, upload):
|
|
| 309 |
|
| 310 |
return results, title
|
| 311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
@st.cache_data
|
| 313 |
def clean_text(text):
|
| 314 |
'''Clean all text after inference'''
|
|
|
|
| 54 |
|
| 55 |
from langchain.prompts import PromptTemplate
|
| 56 |
|
| 57 |
+
from langsmith import Client
|
| 58 |
+
|
| 59 |
+
client = Client()
|
| 60 |
+
|
| 61 |
nltk.download('punkt')
|
| 62 |
|
| 63 |
|
|
|
|
| 313 |
|
| 314 |
return results, title
|
| 315 |
|
| 316 |
+
@st.cache_resource
|
| 317 |
+
def send_feedback(run_id, score):
|
| 318 |
+
client.create_feedback(run_id, "user_score", score=score)
|
| 319 |
+
|
| 320 |
@st.cache_data
|
| 321 |
def clean_text(text):
|
| 322 |
'''Clean all text after inference'''
|