Spaces:
Sleeping
Sleeping
Download ui/interface.py from Socrati/Socraticia: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/Socrati/Socraticia/resolve/main/ui/interface.py
- Command line
-
hf download hf://spaces/Socrati/Socraticia/ui/interface.py
-
curl -L -o interface.py https://huggingface.co/spaces/Socrati/Socraticia/resolve/main/ui/interface.py
1.1 kB
| """ | |
| Interface gráfica da Socrática-IA usando Gradio. | |
| Este módulo é responsável apenas pela interface. | |
| A lógica do tutor permanece no core. | |
| """ | |
| import gradio as gr | |
| from config import Config | |
| from core.tutor import SocraticTutor | |
| class VoiceAIInterface: | |
| """ | |
| Interface principal da VoiceAI. | |
| """ | |
| def __init__(self): | |
| self.tutor = SocraticTutor() | |
| def respond(self, message, history): | |
| """ | |
| Encaminha a mensagem do usuário para o Tutor Socrático. | |
| """ | |
| yield from self.tutor.respond( | |
| message=message, | |
| history=history | |
| ) | |
| def launch(self): | |
| """ | |
| Cria e inicia a interface Gradio. | |
| """ | |
| chatbot = gr.ChatInterface( | |
| fn=self.respond, | |
| title=f"🧠 {Config.APP_NAME}", | |
| description=Config.APP_DESCRIPTION, | |
| ) | |
| chatbot.launch() | |
| def create_interface(): | |
| """ | |
| Cria uma instância da interface. | |
| """ | |
| return VoiceAIInterface() | |
| if __name__ == "__main__": | |
| interface = create_interface() | |
| interface.launch() |