storywriter / app.py
eaglelandsonce's picture
Update app.py
254c667
raw
history blame
1.18 kB
import streamlit as st
import subprocess
import json
st.title('AutoGen Story Writer')
st.markdown('''To learn more join https://www.meetup.com/florence-aws-user-group-meetup/''')
api_key = st.text_input("Enter your Openai API Key:",type="password")
problem = st.text_area("Enter your logline (logline creator - https://huggingface.co/spaces/eaglelandsonce/loglinecreator):", "In a vibrant jungle where laughter is currency, a mischievous monkey named Max must lead his merry band of monkeys on a daring adventure to save their beloved home from a sinister plot that threatens to steal their joy forever.", height=100)
max_round = st.slider('Set maximum rounds:', min_value=1, max_value=100, value=10)
if st.button('Begin Writing Process'):
if api_key and problem:
input_data = {
"problem": problem,
"api_key": api_key,
"max_round": max_round,
}
result = subprocess.check_output(
["python", "query_solver.py"],
input=json.dumps(input_data),
text=True
)
st.write(result.strip())
else:
st.write("Please provide both Open API key and writing problem.")