Rohit Rajpoot commited on
Commit
749d4de
·
1 Parent(s): 460b935

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -27,13 +27,27 @@ question = st.text_input("Enter your question or prompt below:")
27
  # Four buttons side by side, with DeepSeek first
28
  col1, col2, col3, col4 = st.columns(4)
29
 
 
 
 
 
 
30
  with col1:
31
- if st.button("DeepSeek-R1 Demo"):
32
  if not question.strip():
33
  st.warning("Please enter a prompt first.")
34
  else:
35
- with st.spinner("Generating with DeepSeek…"):
36
- out = deepseek_gen(question, max_new_tokens=100, do_sample=True)
 
 
 
 
 
 
 
 
 
37
  st.code(out[0]["generated_text"], language="text")
38
 
39
  with col2:
 
27
  # Four buttons side by side, with DeepSeek first
28
  col1, col2, col3, col4 = st.columns(4)
29
 
30
+ math_prefix = (
31
+ "You are an expert math tutor. Compute the derivative of f(x) = x^2·sin(x) "
32
+ "step by step using the product rule. Show each line of work."
33
+ )
34
+
35
  with col1:
36
+ if st.button("DeepSeek-R1 Math Demo"):
37
  if not question.strip():
38
  st.warning("Please enter a prompt first.")
39
  else:
40
+ # 1) Build the full math prompt
41
+ prompt = f"{math_prefix}\n\nf(x) = {question}\n\nSolution:\n"
42
+ # 2) Call the model deterministically
43
+ with st.spinner("Working it out…"):
44
+ out = deepseek_gen(
45
+ prompt,
46
+ max_new_tokens=80,
47
+ do_sample=False, # no random sampling
48
+ temperature=0.0 # fully deterministic
49
+ )
50
+ # 3) Display the clean, step-by-step answer
51
  st.code(out[0]["generated_text"], language="text")
52
 
53
  with col2: