Foundups commited on
Commit ·
5b5c5de
1
Parent(s): 420bd16
Update styles and add output box with copy functionality
Browse filesFiles changed (4)
- aimindmapAdded+1
- app.pyAdded+116
- hf-space.json+6-6
- requirements.txtAdded+3
1Subproject commit 2c2833cb6586a672eeabdc851847e7b5dd23bc45123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116import streamlit as stimport openaiimport os
# Configure the pagest.set_page_config( page_title="Foundups AI Mind Map", page_icon="🧠", layout="wide")
# Initialize OpenAI API keyopenai.api_key = st.secrets.get("OPENAI_API_KEY", os.getenv("OPENAI_API_KEY"))
# TemplatesTEMPLATES = { "BRAINSTORM": { "name": "Brainstorming", "prompt": "Create a detailed mind map for brainstorming ideas about: ", "style": "creative and expansive" }, "PLANNING": { "name": "Project Planning", "prompt": "Create a structured mind map for planning all aspects of: ", "style": "organized and hierarchical" }, "ANALYSIS": { "name": "Problem Analysis", "prompt": "Create an analytical mind map to break down and solve: ", "style": "logical and systematic" }}
# Title and descriptionst.title("Foundups AI Mind Mapping Tool")st.write("Welcome to the Foundups AI-powered Mind Mapping tool for launching Foundups!")st.write("""A Foundup is an AI-managed tokenized idea for solving a problem that evolves from a Decentralized Autonomous Entity (DAE) into a smartDAO.""")
# Sidebar for settingswith st.sidebar: st.header("Settings") template = st.selectbox( "Template", options=list(TEMPLATES.keys()), format_func=lambda x: TEMPLATES[x]["name"] ) temperature = st.slider( "Temperature", min_value=0.0, max_value=1.0, value=0.7, step=0.1, help="Higher values make the output more creative but less focused" )
# Main input sectioncol1, col2 = st.columns(2)
with col1: problem = st.text_area("Enter the problem you want to solve:", height=100) with col2: solution = st.text_area("What is the solution to the problem?", height=100)
outcome = st.text_area("What is the desired outcome?", height=100)
# Generate buttonif st.button("Generate Mind Map", type="primary", disabled=not all([problem, solution, outcome])): with st.spinner("Generating your mind map..."): try: # Construct the prompt full_prompt = f"{TEMPLATES[template]['prompt']}{problem}\n\nSolution: {solution}\n\nDesired Outcome: {outcome}\n\nStyle: {TEMPLATES[template]['style']}" # Call OpenAI API response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a mind mapping expert. Create a detailed mind map structure in Mermaid.js format."}, {"role": "user", "content": full_prompt} ], temperature=temperature ) # Extract the mind map text mind_map_text = response.choices[0].message.content # Display results st.subheader("Generated Mind Map") st.code(mind_map_text, language="mermaid") # Summary section st.subheader("Summary of your Foundup") st.write(f"**Problem:** {problem}") st.write(f"**Solution:** {solution}") st.write(f"**Outcome:** {outcome}") except Exception as e: st.error(f"Error generating mind map: {str(e)}")
# Help sectionwith st.expander("How to use this tool"): st.write(""" 1. Select a template type from the sidebar 2. Enter your problem, solution, and desired outcome 3. Adjust the temperature setting if needed (higher = more creative) 4. Click 'Generate Mind Map' to create your visualization 5. The mind map will be displayed in Mermaid.js format 6. You can copy the generated code or view the rendered mind map """)
# Footerst.markdown("---")st.markdown("Powered by Foundups® - Building the future of decentralized innovation") 12345678910{"title": "AI Mind Mapping","emoji": "🧠","colorFrom": "#3498db","colorTo": "#2ecc71","sdk": "static","app_file": "build/index.html","pinned": false,"license": "MIT"}12345678910{"title": "AI Mind Map","emoji": "🧠","colorFrom": "blue","colorTo": "green","sdk": "streamlit","app_file": "app.py","pinned": false,"license": "mit"}
123streamlit==1.31.1openai==1.12.0python-dotenv==1.0.0 aimindmapAdded+1
app.pyAdded+116
hf-space.json+6-6
requirements.txtAdded+3