Spaces:
Sleeping
Sleeping
File size: 972 Bytes
242965f 77c225f e8da79a fc7e5cb 5e8e222 c8b3dd8 e8da79a 3d0e861 e8da79a 7cfc686 c74f41d c8b3dd8 37d316b c8b3dd8 c74f41d eccf9ba e8da79a 3099d5b d015f88 77c225f 2dead2b e8da79a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
import agentops, os
from crew import get_crew
LLM = "gpt-4o"
def invoke(openai_api_key, topic):
if (openai_api_key == ""):
raise gr.Error("OpenAI API Key is required.")
if (topic == ""):
raise gr.Error("Topic is required.")
agentops.init(os.environ["AGENTOPS_API_KEY"])
os.environ["OPENAI_API_KEY"] = openai_api_key
return get_crew(LLM).kickoff(inputs={"topic": topic})
gr.close_all()
demo = gr.Interface(fn = invoke,
inputs = [gr.Textbox(label = "OpenAI API Key", type = "password", lines = 1),
gr.Textbox(label = "Topic", value="Evolution of Retrieval-Augmented Generation from Naive RAG to Advanced RAG to Agentic RAG", lines = 2)],
outputs = [gr.Textbox(label = "Output", lines = 1)],
title = "Agentic RAG: LinkedIn Post Generation",
description = os.environ["DESCRIPTION"])
demo.launch() |