import re import streamlit as st import os import sys import asyncio from dotenv import load_dotenv import base64 import nest_asyncio import importlib.util current_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, current_dir) spec = importlib.util.spec_from_file_location("validator_main", os.path.join(os.path.dirname(__file__), "main.py")) validator_main = importlib.util.module_from_spec(spec) spec.loader.exec_module(validator_main) nest_asyncio.apply() st.set_page_config(page_title="Startup Idea Validator Agent", layout="wide") load_dotenv() with open("./src/assets/adk.png", "rb") as adk_file: adk_base64 = base64.b64encode(adk_file.read()).decode() with open("./src/assets/tavily.png", "rb") as tavily_file: tavily_base64 = base64.b64encode(tavily_file.read()).decode() # Create title with embedded images title_html = f"""

🏢 Startup Idea Validator with Google ADK &

""" st.markdown(title_html, unsafe_allow_html=True) st.markdown( "**Discover the perfect startup ideas with AI-powered validation and comprehensive analysis capabilities**" ) with st.sidebar: st.image("./src/assets/Nebius.png", width=150) nebius_api_key = st.text_input( "Enter your Nebius API key", value=os.getenv("NEBIUS_API_KEY", ""), type="password", help="Enter your Nebius API key", ) tavily_api_key = st.text_input( "Enter your Tavily API key", value=os.getenv("TAVILY_API_KEY", ""), type="password", help="Enter your Tavily API key", ) st.markdown( "Get your API keys from [Nebius](https://dub.sh/nebius) and [Tavily](https://dub.sh/tavily)" ) if st.button("Save Keys", use_container_width=True): if nebius_api_key: os.environ["NEBIUS_API_KEY"] = nebius_api_key if tavily_api_key: os.environ["TAVILY_API_KEY"] = tavily_api_key st.success("API keys saved successfully!") # st.markdown("---") st.header("About") st.markdown( """ This application is powered by a set of advanced AI agents for startup idea validation and analysis: - **Idea Clarifier**: Refines and clarifies your startup idea. - **Market Researcher**: Analyzes market potential, size, and customer segments. - **Competitor Analyst**: Evaluates competitors and market positioning. - **Report Generator**: Synthesizes all findings into a comprehensive validation report. Each stage leverages state-of-the-art language models and tools to provide actionable, data-driven insights. """ ) st.markdown("---") st.markdown( "Developed with ❤️ by [Arindam Majumder](https://www.youtube.com/c/Arindam_1729)" ) idea = st.chat_input("Type your message...") # Async runner for validation using nest_asyncio def run_validation_sync(idea, nebius_api_key, tavily_api_key): try: loop = asyncio.get_event_loop() result = loop.run_until_complete( validator_main.run_validation(idea, nebius_api_key, tavily_api_key) ) return result except Exception as e: import traceback error_details = traceback.format_exc() st.error(f"An error occurred during validation: {str(e)}") st.text(f"Full error details:\n{error_details}") return f"Error: {e}\n\nFull traceback:\n{error_details}" if idea: if not nebius_api_key or not tavily_api_key: st.error("Please provide both Nebius and Tavily API keys in the sidebar.") else: with st.spinner("Validating your startup idea. Please wait..."): summary = run_validation_sync(idea, nebius_api_key, tavily_api_key) st.markdown("---") cleaned_report = re.sub(r"^```(?:[a-zA-Z]*)?\n?", "", summary) cleaned_report = re.sub(r"\n?```$", "", cleaned_report) st.markdown(cleaned_report, unsafe_allow_html=True)