aeo_v2 / pages /2_Auto_Generate_Plan_and_Personas.py
ibibek's picture
Upload 32 files
50cb8a1
raw
history blame
1.4 kB
from aeo_ex_generator.aeo_example_generator import ExampleGenerator
import openai
import os
import streamlit as st
import streamlit as st
st.subheader("This space will autognerate the plans and the personas")
OpenAI_Key = st.text_input(" Please enter your OpenAI key here to continue")
# only continue if the key is given
if OpenAI_Key:
st.write("Please wait, it will take a while to generate. ")
os.environ['OPENAI_API_KEY'] = OpenAI_Key
openai.api_key =os.environ['OPENAI_API_KEY']
ex = ExampleGenerator() #declare the instance
e = ex.auto_generate()
st.write(ex.description) #the description is cached in this variable
st.subheader('Prefix Namespaces')
st.write(e['@context']) #here are the prefix namespaces mentioned in the example
result = [i for i in e['@graph']]
st.subheader('Full example:')
try:
st.json(result)
except:
st.text_area("", result, height=400)
if result:
st.subheader("Auto generate specific plan")
keywords = st.text_area("Enter keywords to keep in the plan","breadcrumbtrail")
nkeywords= st.text_area("You can pass keywords to exclude from the example generation", "honeypot")
personas = ex.generate_personas()
st.subheader("Person based on the existing description provided in the deception plan")
st.write( ex.persona_descriptions)