TheHickman commited on
Commit
1946db9
·
verified ·
1 Parent(s): 2cdeb21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -6,8 +6,12 @@ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
6
 
7
  # ---- GPT-5 explanation backend ----
8
  def explain_text(selected_text):
9
- if not selected_text.strip():
10
- return "Highlight some text first 👆"
 
 
 
 
11
 
12
  prompt = f"""
13
  You are an expert machine learning instructor.
 
6
 
7
  # ---- GPT-5 explanation backend ----
8
  def explain_text(selected_text):
9
+ if selected_text is None:
10
+ return ""
11
+
12
+ selected_text = selected_text.strip()
13
+ if not selected_text:
14
+ return "Please select or enter some text first."
15
 
16
  prompt = f"""
17
  You are an expert machine learning instructor.