alibicer commited on
Commit
621cfb5
·
verified ·
1 Parent(s): 4b8cecf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,7 +1,8 @@
1
  import os
2
  import gradio as gr
3
  from openai import OpenAI
4
- from prompts.main_prompt import MAIN_PROMPT # ✅ Fixed Import Path
 
5
 
6
  # ✅ Ensure OpenAI API Key is Set (Use Secrets in Hugging Face)
7
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
@@ -40,8 +41,12 @@ def respond(user_message, history):
40
  with gr.Blocks() as demo:
41
  gr.Markdown("# **AI-Guided Math PD Chatbot**")
42
 
43
- chatbot = gr.Chatbot(height=500)
44
- state_history = gr.State([("", MAIN_PROMPT)])
 
 
 
 
45
 
46
  user_input = gr.Textbox(placeholder="Type your message here...", label="Your Input")
47
 
 
1
  import os
2
  import gradio as gr
3
  from openai import OpenAI
4
+ from prompts.main_prompt import MAIN_PROMPT # ✅ Fix Import Path
5
+ from prompts.initial_prompt import INITIAL_PROMPT # ✅ Ensure Initial Prompt is Included
6
 
7
  # ✅ Ensure OpenAI API Key is Set (Use Secrets in Hugging Face)
8
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
 
41
  with gr.Blocks() as demo:
42
  gr.Markdown("# **AI-Guided Math PD Chatbot**")
43
 
44
+ chatbot = gr.Chatbot(
45
+ value=[("", INITIAL_PROMPT)], # ✅ Shows Initial Prompt on Startup
46
+ height=500
47
+ )
48
+
49
+ state_history = gr.State([("", INITIAL_PROMPT)]) # ✅ Ensures History Starts with Initial Prompt
50
 
51
  user_input = gr.Textbox(placeholder="Type your message here...", label="Your Input")
52