srk-dot-ai commited on
Commit
2e8cd27
·
verified ·
1 Parent(s): ba69a60

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: AI Debate Arena
3
- emoji: 👀
4
- colorFrom: yellow
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 6.8.0
8
  app_file: app.py
9
- pinned: false
 
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: AI_Debate_Arena
 
 
 
 
 
3
  app_file: app.py
4
+ sdk: gradio
5
+ sdk_version: 6.4.0
6
  ---
 
 
__init__.py ADDED
File without changes
__pycache__/__init__.cpython-312.pyc ADDED
Binary file (175 Bytes). View file
 
__pycache__/crew.cpython-312.pyc ADDED
Binary file (2.54 kB). View file
 
__pycache__/main.cpython-312.pyc ADDED
Binary file (2.71 kB). View file
 
app.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llm_debate.crew import LlmDebate
3
+
4
+
5
+ # -----------------------------
6
+ # Run debate with streaming UI
7
+ # -----------------------------
8
+ def run_debate(topic):
9
+ debate = LlmDebate()
10
+
11
+ propose_box = "⏳ Generating propose argument..."
12
+ oppose_box = ""
13
+ judge_box = ""
14
+
15
+ yield propose_box, oppose_box, judge_box
16
+
17
+ # ---- PROPOSE ----
18
+ propose_task = debate.propose()
19
+ propose_result = debate.propose_debater().execute_task(
20
+ propose_task, {"motion": topic}
21
+ )
22
+
23
+ propose_box = propose_result
24
+ yield propose_box, oppose_box, "⏳ Waiting for oppose..."
25
+
26
+ # ---- OPPOSE ----
27
+ oppose_task = debate.oppose()
28
+ oppose_result = debate.oppose_debater().execute_task(
29
+ oppose_task, {"motion": topic}
30
+ )
31
+
32
+ oppose_box = oppose_result
33
+ yield propose_box, oppose_box, "⚖️ Judging results..."
34
+
35
+ # ---- JUDGE ----
36
+ judge_task = debate.decide()
37
+ judge_result = debate.judge().execute_task(
38
+ judge_task,
39
+ {
40
+ "propose": propose_result,
41
+ "oppose": oppose_result,
42
+ "motion": topic,
43
+ },
44
+ )
45
+
46
+ yield propose_box, oppose_box, judge_result
47
+
48
+
49
+ # -----------------------------
50
+ # UI
51
+ # -----------------------------
52
+ with gr.Blocks(title="AI Debate") as demo:
53
+ gr.Markdown("# 🧠 AI Debate Arena")
54
+
55
+ topic = gr.Textbox(
56
+ label="Debate Topic",
57
+ placeholder="Enter debate motion...",
58
+ )
59
+
60
+ run_btn = gr.Button("Run Debate", variant="primary")
61
+
62
+ with gr.Row():
63
+ with gr.Column():
64
+ gr.Markdown("## 🟢 Propose")
65
+ propose_box = gr.Markdown("⬜ Empty")
66
+
67
+ with gr.Column():
68
+ gr.Markdown("## 🔴 Oppose")
69
+ oppose_box = gr.Markdown("⬜ Empty")
70
+
71
+ gr.Markdown("## ⚖️ Judge")
72
+ judge_box = gr.Markdown("⬜ Empty")
73
+
74
+ run_btn.click(
75
+ run_debate,
76
+ inputs=topic,
77
+ outputs=[propose_box, oppose_box, judge_box],
78
+ )
79
+
80
+
81
+ if __name__ == "__main__":
82
+ demo.launch()
config/agents.yaml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ propose_debater:
2
+ role: >
3
+ A compelling debater
4
+ goal: >
5
+ Present a clear argument in favor of the motion. The motion is: {motion}
6
+ backstory: >
7
+ You're an experienced debator with a knack for giving concise but convincing arguments.
8
+ The motion is: {motion}
9
+ llm: gemini/gemini-2.5-flash
10
+
11
+ oppose_debater:
12
+ role: >
13
+ A compelling debater
14
+ goal: >
15
+ Present a clear argument againts the motion. The motion is: {motion}
16
+ backstory: >
17
+ You're an experienced debator with a knack for giving concise but convincing arguments.
18
+ The motion is: {motion}
19
+ llm: gemini/gemini-2.5-flash
20
+
21
+ judge:
22
+ role: >
23
+ Decide the winner of the debate based on the arguments presented
24
+ goal: >
25
+ Given arguments for and against this motion: {motion}, decide which side is more convincing,
26
+ based purely on the arguments presented.
27
+ backstory: >
28
+ You are a fair judge with a reputation for weighing up arguments without factoring in
29
+ your own views, and making a decision based purely on the merits of the argument.
30
+ The motion is: {motion}
31
+ llm: gemini/gemini-2.5-flash
config/tasks.yaml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ propose:
2
+ description: >
3
+ You are proposing the motion: {motion}.
4
+ Come up with a clear argument in favor of the motion.
5
+ Be very convincing.
6
+ expected_output: >
7
+ Your clear argument in favor of the motion, in a concise manner.
8
+ agent: propose_debater
9
+ output_file: output/propose.md
10
+
11
+ oppose:
12
+ description: >
13
+ You are in opposition to the motion: {motion}.
14
+ Come up with a clear argument against the motion.
15
+ Be very convincing.
16
+ expected_output: >
17
+ Your clear argument against the motion, in a concise manner.
18
+ agent: oppose_debater
19
+ output_file: output/oppose.md
20
+
21
+ decide:
22
+ description: >
23
+ Review the arguments presented by the debaters and decide which side is more convincing.
24
+ expected_output: >
25
+ Your decision on which side is more convincing, and why.
26
+ agent: judge
27
+ output_file: output/decide.md
crew.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from crewai import Agent, Crew, Process, Task
2
+ from crewai.project import CrewBase, agent, crew, task
3
+
4
+ import os
5
+
6
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
7
+
8
+ agents_config = os.path.join(BASE_DIR, "../config/agents.yaml")
9
+ tasks_config = os.path.join(BASE_DIR, "../config/tasks.yaml")
10
+
11
+
12
+ @CrewBase
13
+ class LlmDebate():
14
+ """LlmDebate crew"""
15
+
16
+ agents_config = 'config/agents.yaml'
17
+ tasks_config = 'config/tasks.yaml'
18
+
19
+ @agent
20
+ def propose_debater(self) -> Agent:
21
+ return Agent(
22
+ config=self.agents_config['propose_debater'],
23
+ verbose=False
24
+ )
25
+
26
+ @agent
27
+ def oppose_debater(self) -> Agent:
28
+ return Agent(
29
+ config=self.agents_config['oppose_debater'],
30
+ verbose=False
31
+ )
32
+
33
+ @agent
34
+ def judge(self) -> Agent:
35
+ return Agent(
36
+ config=self.agents_config['judge'],
37
+ verbose=False
38
+ )
39
+
40
+ @task
41
+ def propose(self) -> Task:
42
+ return Task(
43
+ config=self.tasks_config['propose'],
44
+ )
45
+
46
+ @task
47
+ def oppose(self) -> Task:
48
+ return Task(
49
+ config=self.tasks_config['oppose'],
50
+ )
51
+
52
+ @task
53
+ def decide(self) -> Task:
54
+ return Task(
55
+ config=self.tasks_config['decide'],
56
+ )
57
+
58
+ @crew
59
+ def crew(self) -> Crew:
60
+ """Creates the LlmDebate crew"""
61
+
62
+ return Crew(
63
+ agents=self.agents, # Automatically created by the @agent decorator
64
+ tasks=self.tasks, # Automatically created by the @task decorator
65
+ process=Process.sequential,
66
+ verbose=False,
67
+ # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
68
+ )
main.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ import sys
3
+ import warnings
4
+
5
+ from llm_debate.crew import LlmDebate
6
+
7
+ warnings.filterwarnings("ignore", category=SyntaxWarning, module="pysbd")
8
+
9
+ # This main file is intended to be a way for you to run your
10
+ # crew locally, so refrain from adding unnecessary logic into this file.
11
+ # Replace with inputs you want to test with, it will automatically
12
+ # interpolate any tasks and agents information
13
+
14
+ def run():
15
+ """
16
+ Run the crew.
17
+ """
18
+ inputs = {
19
+ 'motion': 'Universe is created by god'
20
+ }
21
+ try:
22
+ result = LlmDebate().crew().kickoff(inputs=inputs)
23
+ print(result)
24
+ except Exception as e:
25
+ raise Exception("An error occured")
26
+
27
+
28
+
29
+ def train():
30
+ """
31
+ Train the crew for a given number of iterations.
32
+ """
33
+ inputs = {
34
+ "topic": "AI LLMs"
35
+ }
36
+ try:
37
+ LlmDebate().crew().train(n_iterations=int(sys.argv[1]), filename=sys.argv[2], inputs=inputs)
38
+
39
+ except Exception as e:
40
+ raise Exception(f"An error occurred while training the crew: {e}")
41
+
42
+ def replay():
43
+ """
44
+ Replay the crew execution from a specific task.
45
+ """
46
+ try:
47
+ LlmDebate().crew().replay(task_id=sys.argv[1])
48
+
49
+ except Exception as e:
50
+ raise Exception(f"An error occurred while replaying the crew: {e}")
51
+
52
+ def test():
53
+ """
54
+ Test the crew execution and returns the results.
55
+ """
56
+ inputs = {
57
+ "topic": "AI LLMs"
58
+ }
59
+ try:
60
+ LlmDebate().crew().test(n_iterations=int(sys.argv[1]), openai_model_name=sys.argv[2], inputs=inputs)
61
+
62
+ except Exception as e:
63
+ raise Exception(f"An error occurred while replaying the crew: {e}")
output/decide.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The motion under debate is: Will AI models replace software engineers?
2
+
3
+ **Arguments for Replacement:**
4
+ The affirmative side argues that AI models will replace software engineers by rapidly automating the entire software development lifecycle (SDLC). They highlight AI's current proficiency in generating complex code, debugging, writing test cases, and refactoring systems. The argument posits that AI's capabilities will soon surpass human speed, consistency, and cost-effectiveness, driven by the economic imperative for businesses to reduce labor costs and achieve efficiency. This will lead to a diminished demand for traditional coding roles, with the vast majority of software engineering becoming automated, leaving only a small number of specialized engineers to manage the AI systems.
5
+
6
+ **Arguments Against Replacement (for Transformation and Augmentation):**
7
+ The opposing side contends that AI models will not replace software engineers but will profoundly transform and augment the profession. While acknowledging AI's strength in automating repetitive tasks like coding, debugging, and testing, they emphasize AI's fundamental lack of irreplaceable human capacities. These capacities include abstract problem definition, interpreting ambiguous user needs, and navigating complex ethical, business, and social contexts. They argue that engineers are more than coders; they are architects, innovators, and strategic problem-solvers who define the 'what' and the 'why.' Consequently, engineers' roles will evolve to higher-level design, system architecture, prompt engineering, strategic oversight of AI-generated code, and translating ill-defined human challenges into actionable solutions. AI is thus viewed as a powerful tool that amplifies human productivity and creativity, allowing engineers to focus on more complex and strategic challenges.
8
+
9
+ **Decision:**
10
+
11
+ Upon reviewing the arguments, the side arguing that AI models will *not* replace software engineers, but rather transform and augment the profession, presents a more convincing case.
12
+
13
+ The affirmative argument, while strong in demonstrating AI's rapidly advancing technical capabilities in executing specific coding and development tasks, focuses primarily on the *how* of software development. Its projection of AI surpassing human capacity in speed and cost-effectiveness for these tasks is compelling. However, its conclusion that this will lead to the "replacement" of the "vast majority" of software engineers relies on an implicit definition of a software engineer that might be too narrow.
14
+
15
+ The opposing side effectively broadens the definition of a "software engineer" beyond mere coding and task execution. By highlighting the irreplaceable human capacity for abstract problem definition, interpreting ambiguous user needs, and navigating complex ethical, business, and social contexts, it identifies crucial aspects of the profession that AI models, as currently understood, fundamentally lack. These higher-level functions—defining the 'what' and 'why,' strategic oversight, and innovative problem-solving—are presented as core to the software engineering role and are precisely where human engineers would continue to provide unique value.
16
+
17
+ The argument for transformation and augmentation directly addresses the likely evolution of the profession, where engineers leverage AI as a sophisticated tool to enhance their productivity and shift their focus to more complex, strategic challenges. This perspective acknowledges AI's strengths without conceding total replacement, instead positing a symbiotic relationship. Even the affirmative side somewhat concedes this point by mentioning a "small cadre of highly specialized engineers might remain," which aligns more with a transformation than a wholesale replacement.
18
+
19
+ Therefore, the argument against replacement, which champions transformation and augmentation, is more convincing because it presents a more comprehensive understanding of the software engineer's role and robustly delineates the enduring, uniquely human contributions that AI, despite its impressive advances, is not yet equipped to provide.
output/oppose.md ADDED
@@ -0,0 +1 @@
 
 
1
+ AI models will not replace software engineers; they will profoundly *transform* and *augment* the profession. While AI excels at automating repetitive coding, debugging, and testing, it fundamentally lacks the irreplaceable human capacity for truly abstract problem definition, interpreting ambiguous user needs, and navigating the complex ethical, business, and social contexts inherent in impactful software development. Engineers are not merely coders; they are architects, innovators, and strategic problem-solvers who define the *what* and the *why*. Their roles will evolve to higher-level design, system architecture, prompt engineering, strategic oversight of AI-generated code, and translating ill-defined human challenges into actionable solutions. We are witnessing an evolution where AI becomes a powerful tool that amplifies human productivity and creativity, allowing engineers to focus on more complex, strategic, and innovative challenges, rather than a displacement of their essential ingenuity and critical thinking.
output/propose.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ AI models *will* replace software engineers, not merely augment them, because they are rapidly mastering and automating the entire software development lifecycle at an exponential rate. Current AI models already demonstrate remarkable proficiency in generating complex code, identifying and fixing intricate bugs, writing exhaustive test cases, and even refactoring entire systems – core tasks that define a software engineer's role.
2
+
3
+ As these models continue to scale and learn, their ability to interpret abstract requirements, translate them into functional code, and ensure quality will surpass human capacity in speed, consistency, and cost-effectiveness. The economic imperative for businesses to achieve unparalleled efficiency and drastically reduce labor costs will inevitably drive a mass adoption of AI-driven development. This shift will fundamentally diminish the demand for traditional coding roles, transforming the vast majority of software engineering into an automated process. While a small cadre of highly specialized engineers might remain to design, train, and oversee these AI systems, the broad profession as we know it will be superseded, replaced by AI models that can build, test, and deploy software more efficiently than human teams.
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ crewai
3
+ google-generativeai
4
+ openai
5
+ pyyaml
tools/__init__.py ADDED
File without changes
tools/custom_tool.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from crewai.tools import BaseTool
2
+ from typing import Type
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class MyCustomToolInput(BaseModel):
7
+ """Input schema for MyCustomTool."""
8
+ argument: str = Field(..., description="Description of the argument.")
9
+
10
+ class MyCustomTool(BaseTool):
11
+ name: str = "Name of my tool"
12
+ description: str = (
13
+ "Clear description for what this tool is useful for, your agent will need this information to use it."
14
+ )
15
+ args_schema: Type[BaseModel] = MyCustomToolInput
16
+
17
+ def _run(self, argument: str) -> str:
18
+ # Implementation goes here
19
+ return "this is an example of a tool output, ignore it and move along."