Spaces:
Runtime error
Runtime error
import logging | |
import gradio as gr | |
import asyncio | |
from codette_agent import CodetteAgent, load_json_config, setup_logging | |
class HuggingFaceChatbot: | |
def __init__(self): | |
config = load_json_config("config.json") | |
setup_logging(config) | |
self.codette = CodetteAgent(config) | |
def setup_interface(self): | |
async def chatbot_logic(user_input: str) -> str: | |
return await self.codette.generate_response(user_input) | |
def sync_chatbot(user_input: str) -> str: | |
return asyncio.run(chatbot_logic(user_input)) | |
text_interface = gr.Interface( | |
fn=sync_chatbot, | |
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() | |