Spaces:
Running
Running
vaishnav commited on
Commit ·
77451de
1
Parent(s): c8862d8
add reset button
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import configs.config as config
|
|
| 4 |
import services.scraper
|
| 5 |
import stores.chroma
|
| 6 |
from llm_setup.llm_setup import LLMService
|
|
|
|
| 7 |
|
| 8 |
logger = logging.getLogger() # Create a logger object
|
| 9 |
logger.setLevel(logging.INFO) # Set the logging level to INFO
|
|
@@ -39,14 +40,15 @@ def echo(text, chat_history, request: gr.Request):
|
|
| 39 |
|
| 40 |
|
| 41 |
def on_reset_button_click():
|
| 42 |
-
llm_svc.store=
|
| 43 |
-
|
| 44 |
|
| 45 |
if __name__ == '__main__':
|
| 46 |
logging.info("Starting AIVIz Bot")
|
| 47 |
|
| 48 |
with gr.Blocks() as demo:
|
| 49 |
gr.ChatInterface(fn=echo, type="messages")
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# Launch the interface
|
| 52 |
demo.launch()
|
|
|
|
| 4 |
import services.scraper
|
| 5 |
import stores.chroma
|
| 6 |
from llm_setup.llm_setup import LLMService
|
| 7 |
+
from caching.lfu import LFUCache
|
| 8 |
|
| 9 |
logger = logging.getLogger() # Create a logger object
|
| 10 |
logger.setLevel(logging.INFO) # Set the logging level to INFO
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
def on_reset_button_click():
|
| 43 |
+
llm_svc.store=LFUCache(capacity=50)
|
|
|
|
| 44 |
|
| 45 |
if __name__ == '__main__':
|
| 46 |
logging.info("Starting AIVIz Bot")
|
| 47 |
|
| 48 |
with gr.Blocks() as demo:
|
| 49 |
gr.ChatInterface(fn=echo, type="messages")
|
| 50 |
+
reset_button = gr.Button("Reset Chat Memory Cache")
|
| 51 |
+
reset_button.click(on_reset_button_click)
|
| 52 |
|
| 53 |
# Launch the interface
|
| 54 |
demo.launch()
|