Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import streamlit as st
|
| 3 |
+
|
| 4 |
+
# Load the JSON file
|
| 5 |
+
with open('role_configure.json', 'r') as file:
|
| 6 |
+
role_data = json.load(file)
|
| 7 |
+
|
| 8 |
+
st.title("PrecisionCare Agent Interaction System")
|
| 9 |
+
|
| 10 |
+
# Select agent type
|
| 11 |
+
agent_type = st.selectbox("Select an agent type:", role_data['roles'].keys())
|
| 12 |
+
|
| 13 |
+
# Get the selected agent's data
|
| 14 |
+
agent_info = role_data['roles'][agent_type]
|
| 15 |
+
st.write(f"Interacting with {agent_info['name']}")
|
| 16 |
+
|
| 17 |
+
# Multiple prompt options
|
| 18 |
+
prompt_options = st.multiselect("Select tasks to perform:", [task['task'] for task in agent_info['prompts']])
|
| 19 |
+
|
| 20 |
+
# Display input fields for selected tasks
|
| 21 |
+
for prompt in prompt_options:
|
| 22 |
+
task_info = next(item for item in agent_info['prompts'] if item['task'] == prompt)
|
| 23 |
+
if task_info['input_type'] == 'textarea':
|
| 24 |
+
user_input = st.text_area(task_info['input_label'])
|
| 25 |
+
st.write(f"{agent_info['name']} - {task_info['task']}: {user_input}")
|
| 26 |
+
|
| 27 |
+
# Submit the interaction
|
| 28 |
+
if st.button("Submit"):
|
| 29 |
+
st.write(f"Interactions for {agent_type} have been submitted.")
|