Spaces:
Sleeping
Sleeping
Update app.py
Browse files12344567832 unmodified lines4142434344444546474849505152import osimport gradio as grfrom openai import OpenAIfrom prompts.main_prompt import MAIN_PROMPT # ✅ Fixed Import Pathfrom prompts.main_prompt import MAIN_PROMPT # ✅ Fix Import Pathfrom prompts.initial_prompt import INITIAL_PROMPT # ✅ Ensure Initial Prompt is Included
# ✅ Ensure OpenAI API Key is Set (Use Secrets in Hugging Face)OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")32 unmodified lineswith gr.Blocks() as demo: gr.Markdown("# **AI-Guided Math PD Chatbot**") chatbot = gr.Chatbot(height=500) state_history = gr.State([("", MAIN_PROMPT)]) chatbot = gr.Chatbot( value=[("", INITIAL_PROMPT)], # ✅ Shows Initial Prompt on Startup height=500 )
state_history = gr.State([("", INITIAL_PROMPT)]) # ✅ Ensures History Starts with Initial Prompt
user_input = gr.Textbox(placeholder="Type your message here...", label="Your Input")
app.py+8-3