| import warnings |
| import os |
| import sys |
|
|
| |
| sys.stdout.reconfigure(encoding='utf-8') |
|
|
| from huggingface_hub import HfApi, login |
| import gradio as gr |
|
|
| |
| warnings.filterwarnings("ignore", category=SyntaxWarning, module="pydub") |
| warnings.filterwarnings( |
| "ignore", |
| message=r".*HTTP_422_UNPROCESSABLE_ENTITY.*HTTP_422_UNPROCESSABLE_CONTENT.*", |
| category=Warning, |
| module=r"gradio\.routes", |
| ) |
|
|
| |
| from config import AppConfig |
| from src.utils import create_warning_beep |
|
|
| |
| from src.managers import GeminiManager, HFManager, GroqManager |
| from src.input_agent import AgentInput |
| from src.brain_agent import AgentInterpretation |
| from src.trust_agent import AgentTrust |
| from src.ux_agent import AgentUX |
| from src.acoustic_agent import AgentAcoustic |
|
|
| |
| import recover_chain |
|
|
| |
| print("🔄 Initiating Blockchain Recovery Sequence...") |
| try: |
| |
| recover_chain.main() |
| print("✅ Recovery Complete!") |
| except Exception as e: |
| print(f"❌ Recovery Failed: {e}") |
|
|
| |
| |
| |
| def create_app(): |
| print("🚀 Initializing PureVersation...") |
|
|
| |
| AppConfig.setup_directories() |
| |
| |
| |
| if AppConfig.HF_TOKEN: |
| login(token=AppConfig.HF_TOKEN) |
| print("✅ Hugging Face Global Login Successful.") |
| else: |
| print("🚨 WARNING: HF_TOKEN is missing in AppConfig! Downloads will fail.") |
|
|
| |
| |
| hf_manager = HFManager(AppConfig) |
| hf_manager.pull_datasets() |
|
|
| |
| groq_manager = GroqManager(AppConfig.GROQ_API_KEY) if AppConfig.GROQ_API_KEY else None |
| |
| |
| |
|
|
| |
| |
| |
| agent1 = AgentInput() |
| |
| |
| |
| |
|
|
| |
| agent2 = AgentInterpretation(AppConfig, gemini_manager_instance=groq_manager) |
| |
| |
| |
| agent4 = AgentTrust(AppConfig) |
| |
| agent4.hf_manager_ref = hf_manager |
|
|
| |
| agent5 = AgentAcoustic(groq_manager) |
| agent4.acoustic_agent = agent5 |
|
|
| |
| agent3 = AgentUX(agent1, agent2, agent4) |
| |
| |
| print("✅ System Assembled. Launching Interface...") |
| |
| |
| agent3.alert_sound = create_warning_beep() |
| |
| |
| app = agent3.create_ui() |
|
|
| |
| app.queue(default_concurrency_limit=10) |
| |
| return app |
|
|
| |
| demo = create_app() |
|
|
| from api import app as api_app |
|
|
| app = gr.mount_gradio_app( |
| api_app, |
| demo, |
| path="/", |
| ssr_mode=False, |
| theme=gr.themes.Soft(primary_hue="blue"), |
| ) |
|
|
| if __name__ == "__main__": |
| import uvicorn |
|
|
| uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", "7860"))) |
| |
|
|