Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files734 unmodified lines735736737738739740741742273 unmodified lines101610171018101910201021102245 unmodified lines10681069107010711072107310741075107610771078140 unmodified lines12191220122112221223122412251226734 unmodified lines"huggingface/meta-llama/Llama-3.1-8B-Instruct",])self.working_models = candidate_modelsif self.provider_keys.get("openrouter"):candidate_models = ["openrouter/moonshotai/kimi-k2:free",273 unmodified linesif m not in blocked_modelsand not (m.startswith("openrouter/") and not self.provider_keys.get("openrouter"))]models_to_try.sort(key=lambda m: (1 if m.startswith("gemini/") else 0))for model_name in models_to_try:if not hasattr(self, "_build_model") or not hasattr(self, "agent"):45 unmodified linesreturn f"Error initializing agent: {e}", None# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)agent_code = (f"[https://huggingface.co/spaces/](https://huggingface.co/spaces/){space_id}/tree/main"if space_idelse (os.getenv("AGENT_CODE_URL")or f"[https://huggingface.co/spaces/](https://huggingface.co/spaces/){username.strip()}/Final_Assignment_Template/tree/main").strip())print(agent_code)140 unmodified linesif space_id_startup: # Print repo URLs if SPACE_ID is foundprint(f"✅ SPACE_ID found: {space_id_startup}")print(f" Repo URL: [https://huggingface.co/spaces/](https://huggingface.co/spaces/){space_id_startup}")print(f" Repo Tree URL: [https://huggingface.co/spaces/](https://huggingface.co/spaces/){space_id_startup}/tree/main")else:print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")734 unmodified lines735736737738739740273 unmodified lines10141015101610171018101945 unmodified lines10651066106710681069107010711072107310741075140 unmodified lines12161217121812191220122112221223734 unmodified lines"huggingface/meta-llama/Llama-3.1-8B-Instruct",])if self.provider_keys.get("openrouter"):candidate_models = ["openrouter/moonshotai/kimi-k2:free",273 unmodified linesif m not in blocked_modelsand not (m.startswith("openrouter/") and not self.provider_keys.get("openrouter"))]for model_name in models_to_try:if not hasattr(self, "_build_model") or not hasattr(self, "agent"):45 unmodified linesreturn f"Error initializing agent: {e}", None# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)agent_code = (f"https://huggingface.co/spaces/{space_id}/tree/main"if space_idelse (os.getenv("AGENT_CODE_URL")or f"https://huggingface.co/spaces/{username.strip()}/Final_Assignment_Template/tree/main").strip())print(agent_code)140 unmodified linesif space_id_startup: # Print repo URLs if SPACE_ID is foundprint(f"✅ SPACE_ID found: {space_id_startup}")print(f" Repo URL: https://huggingface.co/spaces/{space_id_startup}")print(f" Repo Tree URL: https://huggingface.co/spaces/{space_id_startup}/tree/main")else:print("ℹ️ SPACE_ID environment variable not found (running locally?). Repo URL cannot be determined.")
app.py+4-7