crewai / app.py
GeminiAi's picture
Update app.py
4efd16c verified
import gradio as gr
from crew import LatestAiDevelopmentCrew
def run_research(topic: str):
# Run the crew process with the given topic
inputs = {'topic': topic}
crew = LatestAiDevelopmentCrew()
result = crew.crew().kickoff(inputs=inputs) # Assuming it returns a result
return result
def clear_input():
return "", "" # Clear the inputs and output
# Gradio UI layout
with gr.Blocks() as demo:
gr.Markdown("## Latest AI Development Research")
# Topic Input Section
with gr.Row():
topic_input = gr.Textbox(label="Enter Topic", placeholder="Enter a topic for AI research...", lines=1)
# Submit and Clear Buttons Section
with gr.Row():
submit_button = gr.Button("Submit")
clear_button = gr.Button("Clear")
# Output Section to show research results
with gr.Row():
output = gr.Textbox(label="Research Result", placeholder="Research results will appear here.", interactive=False, lines=5)
# Connect functions to the interface
submit_button.click(run_research, inputs=topic_input, outputs=output)
clear_button.click(clear_input, inputs=[], outputs=[topic_input, output])
# Launch the interface
demo.launch()