|
import gradio as gr |
|
import os |
|
|
|
from multi_agent import run_multi_agent |
|
|
|
LLM = "gpt-4o" |
|
|
|
def invoke(openai_api_key): |
|
if (openai_api_key == ""): |
|
raise gr.Error("OpenAI API Key is required.") |
|
|
|
os.environ["OPENAI_API_KEY"] = openai_api_key |
|
|
|
return run_multi_agent(LLM) |
|
|
|
gr.close_all() |
|
|
|
demo = gr.Interface(fn = invoke, |
|
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1)], |
|
outputs = [gr.Textbox(label = "Chess Game", value=os.environ["OUTPUT"])], |
|
title = "Chess Game: AI Player White vs. AI Player Black", |
|
description = os.environ["DESCRIPTION"]) |
|
|
|
demo.launch() |