File size: 1,216 Bytes
1717905 4efd16c 1717905 4efd16c 1717905 4efd16c 1717905 4efd16c 1717905 4efd16c 1717905 4efd16c |
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 30 31 32 33 34 35 36 37 |
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()
|