Spaces:
Sleeping
Sleeping
Update app.py
Browse files13 unmodified lines141516171819202159 unmodified lines81828384858687888914 unmodified lines10410510610710810911050 unmodified lines16116216316416516618 unmodified lines1851861871881891903 unmodified lines19419519619719813 unmodified linesfrom tools.gaia_tool import GaiaQAToolfrom tools.wiki_tool import WikiSearchToolfrom tools.search_summary_tool import SearchSummaryToolfrom tools.youtube_species_tool import YouTubeSpeciesToolfrom tools.youtube_transcription_tool import YouTubeTranscriptionToolfrom tools.excel_tool import ExcelToolfrom tools.codegen_tool import CodeGenToolfrom tools.web_search_tool import WebSearchTool59 unmodified lines- Run Python code: PythonExecTool- Web scraping/search: WebSearchTool- Code generation: CodeGenToolRemember: return only the tool output."""if not profile:return "Please login to Hugging Face.", Noneusername = profile.username14 unmodified linesStringTool, ChessTool, GroupTool,GroceryTool, PythonExecTool]tools = [Tool(name=cls().name, func=cls()._run, description=cls().description) for cls in tool_classes]agent = initialize_agent(tools=tools,llm=llm,50 unmodified linesexcept Exception:raw = agent.run(system_prefix + "\n" + q)ans = normalize_answer(raw)results.append({"Task ID": tid, "Question": q, "Submitted Answer": ans})payload.append({"task_id": tid, "submitted_answer": ans})18 unmodified linesreturn status, pd.DataFrame(results)# Gradio UIwith gr.Blocks() as demo:gr.Markdown("# AI Agents Course — Final Exam Runner")3 unmodified linestable = gr.DataFrame(label="Results")run_btn.click(fn=run_and_submit_all, outputs=[status_box, table])if __name__ == "__main__":demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))13 unmodified lines14151617181959 unmodified lines798081828384858614 unmodified lines10110210310410510610710810911050 unmodified lines16116216316416516616716816917018 unmodified lines1891901911921931941953 unmodified lines19920020120220320420513 unmodified linesfrom tools.gaia_tool import GaiaQAToolfrom tools.wiki_tool import WikiSearchToolfrom tools.search_summary_tool import SearchSummaryToolfrom tools.excel_tool import ExcelToolfrom tools.codegen_tool import CodeGenToolfrom tools.web_search_tool import WebSearchTool59 unmodified lines- Run Python code: PythonExecTool- Web scraping/search: WebSearchTool- Code generation: CodeGenTool"""if not profile:return "Please login to Hugging Face.", Noneusername = profile.username14 unmodified linesStringTool, ChessTool, GroupTool,GroceryTool, PythonExecTool]tools = [Tool(name=cls().name, func=cls()._run, description=cls().description)for cls in tool_classes]agent = initialize_agent(tools=tools,llm=llm,50 unmodified linesexcept Exception:raw = agent.run(system_prefix + "\n" + q)# Убираем заглушки YouTubeif isinstance(raw, str) and raw.startswith("ERROR: YouTube"):raw = ""ans = normalize_answer(raw)results.append({"Task ID": tid, "Question": q, "Submitted Answer": ans})payload.append({"task_id": tid, "submitted_answer": ans})18 unmodified linesreturn status, pd.DataFrame(results)# Gradio UIwith gr.Blocks() as demo:gr.Markdown("# AI Agents Course — Final Exam Runner")3 unmodified linestable = gr.DataFrame(label="Results")run_btn.click(fn=run_and_submit_all, outputs=[status_box, table])if __name__ == "__main__":demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
app.py+12-5