import logging | |
import gradio as gr | |
import asyncio | |
from codette_reasoning import UniversalReasoning, load_json_config, setup_logging | |
class HuggingFaceChatbot: | |
def __init__(self): | |
config = load_json_config("config.json") | |
setup_logging(config) | |
self.reasoning_engine = UniversalReasoning(config) | |
def setup_interface(self): | |
async def chatbot_logic(user_input: str) -> str: | |
return await self.reasoning_engine.generate_response(user_input) | |
text_interface = gr.Interface( | |
fn=chatbot_logic, | |
inputs=gr.Textbox(label="Ask Codette Anything"), | |
outputs=gr.Textbox(label="Codette's Thoughts"), | |
title="🧠 Codette: Multimodal Reasoning Chatbot" | |
) | |
return text_interface | |
def launch(self): | |
app = self.setup_interface() | |
app.launch() |