kidwaiaun's picture
Update app.py
2542dc1 verified
import gradio as gr
import yaml
def tab1_content():
with gr.Row():
with gr.Column():
gr.Textbox(label="Project:", placeholder="Enter project type")
gr.Textbox(label="Industry:", placeholder="Enter the industry")
gr.Textbox(label="Project Objectives:", placeholder="Enter project objective")
gr.Textbox(label="Team Members:", placeholder="Enter team member and their position")
gr.Textbox(label="Project Requirements:", placeholder="Enter detailed list of project requirements")
gr.Button("Submit Form")
with gr.Column():
gr.Textbox(label="Input 2", placeholder="Enter something for column 2")
gr.Button("Submit Column 2")
def tab2_content():
def display_agent_data():
try:
file_name = "config/data/agents.yaml"
with open(file_name, 'r') as file:
data = yaml.safe_load(file)
formatted_output = ""
for agent, details in data.items():
formatted_output += f"<h3>{agent.replace('_', ' ').title()}</h3>"
formatted_output += f"<strong>Role:</strong> {details['role']}<br>"
formatted_output += f"<strong>Goal:</strong> {details['goal']}<br>"
formatted_output += f"<strong>Backstory:</strong> {details['backstory']}<br>"
formatted_output += f"<strong>Allow Delegation:</strong> {'Yes' if details['allow_delegation'] else 'No'}<br>"
formatted_output += f"<strong>Verbose:</strong> {'Yes' if details['verbose'] else 'No'}<br><br>"
return formatted_output
except Exception as e:
return f"Error: {str(e)}"
gr.HTML(value=display_agent_data())
def tab3_content():
def display_task_data():
try:
file_name = "config/data/tasks.yaml"
with open(file_name, 'r') as file:
data = yaml.safe_load(file)
formatted_output = ""
for task, details in data.items():
formatted_output += f"<h3>{task.replace('_', ' ').title()}</h3>"
formatted_output += f"<strong>Description:</strong> {details['description']}<br>"
formatted_output += f"<strong>Expected Output:</strong> {details['expected_output']}<br><br>"
return formatted_output
except Exception as e:
return f"Error: {str(e)}"
gr.HTML(value=display_task_data())
with gr.Blocks() as agentApp:
with gr.Tab("Parameters"):
tab1_content()
with gr.Tab("Agents"):
tab2_content()
with gr.Tab("Tasks"):
tab3_content()
agentApp.launch()