Spaces:
Sleeping
Sleeping
Add logging through HF Datasets
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import os
|
2 |
-
import logging
|
3 |
|
4 |
import gradio as gr
|
5 |
import pkg_resources
|
@@ -18,9 +17,7 @@ def package_installed(package_name):
|
|
18 |
|
19 |
|
20 |
def answer(query):
|
21 |
-
logging.info(f"Query: {query}")
|
22 |
answer = agent.answer(query=query)
|
23 |
-
logging.info(f"Answer: {answer}")
|
24 |
return answer
|
25 |
|
26 |
|
@@ -41,6 +38,8 @@ I built this using [Gradio](https://gradio.app) and [LangChain](https://langchai
|
|
41 |
""" # noqa: E501
|
42 |
title = "Career Chatbot"
|
43 |
|
|
|
|
|
44 |
iface = gr.Interface(
|
45 |
fn=answer,
|
46 |
inputs=gr.Textbox(
|
@@ -51,5 +50,6 @@ iface = gr.Interface(
|
|
51 |
title=title,
|
52 |
analytics_enabled=True,
|
53 |
allow_flagging="auto",
|
|
|
54 |
)
|
55 |
iface.launch()
|
|
|
1 |
import os
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import pkg_resources
|
|
|
17 |
|
18 |
|
19 |
def answer(query):
|
|
|
20 |
answer = agent.answer(query=query)
|
|
|
21 |
return answer
|
22 |
|
23 |
|
|
|
38 |
""" # noqa: E501
|
39 |
title = "Career Chatbot"
|
40 |
|
41 |
+
hf_writer = gr.HuggingFaceDatasetSaver(os.getenv("HF_TOKEN"), "cv-assistant-logging")
|
42 |
+
|
43 |
iface = gr.Interface(
|
44 |
fn=answer,
|
45 |
inputs=gr.Textbox(
|
|
|
50 |
title=title,
|
51 |
analytics_enabled=True,
|
52 |
allow_flagging="auto",
|
53 |
+
flagging_callback=hf_writer,
|
54 |
)
|
55 |
iface.launch()
|