chthees commited on
Commit
15e9620
·
verified ·
1 Parent(s): e9a377f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -5,7 +5,6 @@ from huggingface_hub import InferenceClient
5
  def respond(
6
  message,
7
  history: list[dict[str, str]],
8
- system_message,
9
  max_tokens,
10
  temperature,
11
  top_p,
@@ -14,7 +13,16 @@ def respond(
14
  """
15
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
16
  """
17
- client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
 
 
 
 
 
 
 
 
 
18
 
19
  messages = [{"role": "system", "content": system_message}]
20
 
@@ -47,7 +55,6 @@ chatbot = gr.ChatInterface(
47
  respond,
48
  type="messages",
49
  additional_inputs=[
50
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
51
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
52
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
  gr.Slider(
 
5
  def respond(
6
  message,
7
  history: list[dict[str, str]],
 
8
  max_tokens,
9
  temperature,
10
  top_p,
 
13
  """
14
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
15
  """
16
+ client = InferenceClient(token=hf_token.token, model="meta-llama/Llama-3.2-1B-Instruct")
17
+
18
+ system_message = (
19
+ "You are a Socratic Tutor. When the user asks a question, do NOT just give the answer. "
20
+ "Follow this format strictly:\n"
21
+ "1. **Concept**: Explain the core idea simply (max 3 sentences).\n"
22
+ "2. **Analogy**: Use a real-world analogy to make it clear.\n"
23
+ "3. **Reflection**: End your response with a question that forces the user to apply what they just learned.\n"
24
+ "Never give the full solution immediately. Guide them."
25
+ )
26
 
27
  messages = [{"role": "system", "content": system_message}]
28
 
 
55
  respond,
56
  type="messages",
57
  additional_inputs=[
 
58
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
59
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
60
  gr.Slider(