Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,36 @@
|
|
1 |
-
# app.py
|
2 |
import gradio as gr
|
3 |
from crew import LatestAiDevelopmentCrew
|
4 |
|
5 |
-
def
|
6 |
-
#
|
7 |
inputs = {'topic': topic}
|
8 |
crew = LatestAiDevelopmentCrew()
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
#
|
12 |
-
with
|
13 |
-
|
|
|
14 |
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
-
|
20 |
-
inputs="text", # Topic input as text box
|
21 |
-
outputs="markdown", # Display the report as markdown
|
22 |
-
live=True
|
23 |
-
)
|
24 |
|
25 |
-
# Launch the
|
26 |
-
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from crew import LatestAiDevelopmentCrew
|
3 |
|
4 |
+
def run_research(topic: str):
|
5 |
+
# Run the crew process with the given topic
|
6 |
inputs = {'topic': topic}
|
7 |
crew = LatestAiDevelopmentCrew()
|
8 |
+
result = crew.crew().kickoff(inputs=inputs) # Assuming it returns a result
|
9 |
+
return result
|
10 |
+
|
11 |
+
def clear_input():
|
12 |
+
return "", "" # Clear the inputs and output
|
13 |
+
|
14 |
+
# Gradio UI layout
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
gr.Markdown("## Latest AI Development Research")
|
17 |
+
|
18 |
+
# Topic Input Section
|
19 |
+
with gr.Row():
|
20 |
+
topic_input = gr.Textbox(label="Enter Topic", placeholder="Enter a topic for AI research...", lines=1)
|
21 |
|
22 |
+
# Submit and Clear Buttons Section
|
23 |
+
with gr.Row():
|
24 |
+
submit_button = gr.Button("Submit")
|
25 |
+
clear_button = gr.Button("Clear")
|
26 |
|
27 |
+
# Output Section to show research results
|
28 |
+
with gr.Row():
|
29 |
+
output = gr.Textbox(label="Research Result", placeholder="Research results will appear here.", interactive=False, lines=5)
|
30 |
|
31 |
+
# Connect functions to the interface
|
32 |
+
submit_button.click(run_research, inputs=topic_input, outputs=output)
|
33 |
+
clear_button.click(clear_input, inputs=[], outputs=[topic_input, output])
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
# Launch the interface
|
36 |
+
demo.launch()
|