black-forest-labs-FLUX.1-dev / final_codettes_chatbot.py
Raiff1982's picture
Update final_codettes_chatbot.py
23cc739 verified
raw
history blame contribute delete
938 Bytes
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()