Updated readme; tidied leaderboard
Browse files- README.md +3 -1
- arena/c4.py +18 -9
- requirements.txt +2 -1
README.md
CHANGED
@@ -21,8 +21,8 @@ short_description: Arena for playing Four-in-a-row between LLMs
|
|
21 |
It has been great fun making this Arena and watching LLMs duke it out!
|
22 |
|
23 |
Quick links:
|
|
|
24 |
- The [GitHub repo](https://github.com/ed-donner/connect) for the code
|
25 |
-
- The [HuggingFace Spaces](https://huggingface.co/spaces/ed-donner/connect) where it's running
|
26 |
- My [LinkedIn](https://www.linkedin.com/in/eddonner/) - I love connecting!
|
27 |
|
28 |
If you'd like to learn more about this:
|
@@ -37,6 +37,8 @@ If you'd like to learn more about this:
|
|
37 |
4. Activate your environment with either `venv\Scripts\activate` on Windows, or `source venv/bin/activate` on Mac/Linux
|
38 |
5. Then run `pip install -r requirements.txt` to install the packages
|
39 |
|
|
|
|
|
40 |
## Setting up your API keys
|
41 |
|
42 |
Please create a file with the exact name `.env` in the project root directory (connect).
|
|
|
21 |
It has been great fun making this Arena and watching LLMs duke it out!
|
22 |
|
23 |
Quick links:
|
24 |
+
- The [Live Arena](https://edwarddonner.com/connect-four/) courtesy of amazing HuggingFace Spaces
|
25 |
- The [GitHub repo](https://github.com/ed-donner/connect) for the code
|
|
|
26 |
- My [LinkedIn](https://www.linkedin.com/in/eddonner/) - I love connecting!
|
27 |
|
28 |
If you'd like to learn more about this:
|
|
|
37 |
4. Activate your environment with either `venv\Scripts\activate` on Windows, or `source venv/bin/activate` on Mac/Linux
|
38 |
5. Then run `pip install -r requirements.txt` to install the packages
|
39 |
|
40 |
+
If you wish to play with the prototype, run `jupyter lab` to launch the lab then look at the notebook **prototype.ipynb**.
|
41 |
+
|
42 |
## Setting up your API keys
|
43 |
|
44 |
Please create a file with the exact name `.env` in the project root directory (connect).
|
arena/c4.py
CHANGED
@@ -2,6 +2,7 @@ from arena.game import Game
|
|
2 |
from arena.board import RED, YELLOW
|
3 |
from arena.llm import LLM
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
|
7 |
css = """
|
@@ -35,17 +36,25 @@ def message_html(game) -> str:
|
|
35 |
|
36 |
def format_records_for_table(games):
|
37 |
"""
|
38 |
-
Turn the results objects into a
|
39 |
"""
|
40 |
-
|
41 |
[
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
|
51 |
def format_ratings_for_table(ratings):
|
|
|
2 |
from arena.board import RED, YELLOW
|
3 |
from arena.llm import LLM
|
4 |
import gradio as gr
|
5 |
+
import pandas as pd
|
6 |
|
7 |
|
8 |
css = """
|
|
|
36 |
|
37 |
def format_records_for_table(games):
|
38 |
"""
|
39 |
+
Turn the results objects into a pandas DataFrame for the Gradio Dataframe
|
40 |
"""
|
41 |
+
df = pd.DataFrame(
|
42 |
[
|
43 |
+
[
|
44 |
+
game.when,
|
45 |
+
game.red_player,
|
46 |
+
game.yellow_player,
|
47 |
+
"Red" if game.red_won else "Yellow" if game.yellow_won else "Draw",
|
48 |
+
]
|
49 |
+
for game in reversed(games)
|
50 |
+
],
|
51 |
+
columns=["When", "Red Player", "Yellow Player", "Winner"],
|
52 |
+
)
|
53 |
+
|
54 |
+
# Remove microseconds while preserving datetime format
|
55 |
+
df["When"] = pd.to_datetime(df["When"]).dt.floor("s")
|
56 |
+
|
57 |
+
return df
|
58 |
|
59 |
|
60 |
def format_ratings_for_table(ratings):
|
requirements.txt
CHANGED
@@ -8,4 +8,5 @@ google.generativeai
|
|
8 |
anthropic
|
9 |
groq
|
10 |
black
|
11 |
-
pymongo
|
|
|
|
8 |
anthropic
|
9 |
groq
|
10 |
black
|
11 |
+
pymongo
|
12 |
+
pandas
|