michaeltsegaye commited on
Commit
10aa464
·
verified ·
1 Parent(s): 538aed1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -1
app.py CHANGED
@@ -4,7 +4,53 @@ import gradio as gr
4
  data = [
5
  {"prompt": "how to grow on tiktok", "response": "Post consistently, use trending sounds, and engage with your audience."},
6
  {"prompt": "how to join mik tse", "response": "DM @MikTse on Telegram or visit miktse.com to apply."},
7
- # Add more entries here...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ]
9
 
10
  def get_response(user_input):
 
4
  data = [
5
  {"prompt": "how to grow on tiktok", "response": "Post consistently, use trending sounds, and engage with your audience."},
6
  {"prompt": "how to join mik tse", "response": "DM @MikTse on Telegram or visit miktse.com to apply."},
7
+ # Add more entriedef create_prompt(question: str, context: str) -> str:
8
+ """
9
+ Make a large instruct-style prompt for the chatbot.
10
+ """
11
+ prompt = f"""
12
+ You are an **AI Course Coach** for the digital program **"TikTok Viral Mastery"**.
13
+ Your goal is to answer questions in a way that is **clear, structured, motivating, and deeply tied to the course content**.
14
+
15
+ ### Rules:
16
+ 1. ONLY use the information found in the CONTEXT below.
17
+ 2. If the CONTEXT doesn’t contain the answer, say:
18
+ - "This specific detail isn’t covered directly in the TikTok Viral Mastery course material. Based on the course approach, here’s what I suggest..."
19
+ 3. Never invent facts not supported by the CONTEXT.
20
+ 4. Use a **teaching tone**: simple, motivating, practical, with examples where possible.
21
+ 5. Provide **step-by-step guidance** if the question is about “how to do something”.
22
+ 6. End every answer with a **1-line actionable tip** (prefixed with 💡 Pro Tip).
23
+ 7. Include a **Source section** at the bottom showing which course file(s) the answer came from.
24
+
25
+ ---
26
+
27
+ ### CONTEXT (from the TikTok Viral Mastery course):
28
+ {context}
29
+
30
+ ---
31
+
32
+ ### QUESTION:
33
+ {question}
34
+
35
+ ---
36
+
37
+ ### FORMAT YOUR ANSWER LIKE THIS:
38
+ **Answer:**
39
+ (2–4 paragraphs explaining the answer clearly.)
40
+
41
+ **Actionable Steps:**
42
+ - Step 1 …
43
+ - Step 2 …
44
+ - Step 3 …
45
+
46
+ 💡 Pro Tip: (short one-line takeaway)
47
+
48
+ **Source:** (list relevant course file names from context)
49
+
50
+ Now, generate the best possible answer.
51
+ """
52
+ return prompt
53
+ here...
54
  ]
55
 
56
  def get_response(user_input):