Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import os | |
| from rag_langgraph import run_multi_agent | |
| os.environ["LANGCHAIN_TRACING_V2"] = "true" | |
| os.environ["LANGCHAIN_PROJECT"] = "langgraph-multi-agent" | |
| def invoke(openai_api_key, prompt): | |
| if (openai_api_key == ""): | |
| raise gr.Error("OpenAI API Key is required.") | |
| if (prompt == ""): | |
| raise gr.Error("Prompt is required.") | |
| os.environ["OPENAI_API_KEY"] = openai_api_key | |
| return run_multi_agent(prompt) | |
| gr.close_all() | |
| demo = gr.Interface(fn = invoke, | |
| inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1), | |
| gr.Textbox(label = "Input", value="Code hello world and print it to the terminal", lines = 1)], | |
| outputs = [gr.Textbox(label = "Output", value="TODO")], | |
| title = "Multi-Agent RAG: Chart Generation", | |
| description = os.environ["DESCRIPTION"]) | |
| demo.launch() |