Update final_codettes_chatbot.py
Browse files
final_codettes_chatbot.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
import logging
|
| 2 |
import gradio as gr
|
| 3 |
import asyncio
|
| 4 |
-
from
|
| 5 |
|
| 6 |
|
| 7 |
class HuggingFaceChatbot:
|
| 8 |
def __init__(self):
|
| 9 |
config = load_json_config("config.json")
|
| 10 |
setup_logging(config)
|
| 11 |
-
self.
|
| 12 |
|
| 13 |
def setup_interface(self):
|
| 14 |
async def chatbot_logic(user_input: str) -> str:
|
| 15 |
-
return await self.
|
| 16 |
|
| 17 |
def sync_chatbot(user_input: str) -> str:
|
| 18 |
return asyncio.run(chatbot_logic(user_input))
|
|
|
|
| 1 |
import logging
|
| 2 |
import gradio as gr
|
| 3 |
import asyncio
|
| 4 |
+
from codette_agent import CodetteAgent, load_json_config, setup_logging
|
| 5 |
|
| 6 |
|
| 7 |
class HuggingFaceChatbot:
|
| 8 |
def __init__(self):
|
| 9 |
config = load_json_config("config.json")
|
| 10 |
setup_logging(config)
|
| 11 |
+
self.codette = CodetteAgent(config)
|
| 12 |
|
| 13 |
def setup_interface(self):
|
| 14 |
async def chatbot_logic(user_input: str) -> str:
|
| 15 |
+
return await self.codette.generate_response(user_input)
|
| 16 |
|
| 17 |
def sync_chatbot(user_input: str) -> str:
|
| 18 |
return asyncio.run(chatbot_logic(user_input))
|