manthilaffs commited on
Commit
67b5925
·
verified ·
1 Parent(s): 94b6237

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -29,7 +29,7 @@ def infer(message, history, enable_history=False, max_new_tokens=512):
29
  )
30
  model.eval()
31
 
32
- # Optional history
33
  if enable_history and history:
34
  prev = "\n".join(
35
  [f"User: {h[0]}\nGamunu: {h[1]}" for h in history if h[1] is not None]
@@ -63,7 +63,7 @@ with gr.Blocks() as demo:
63
  enable_history = gr.Checkbox(label="Enable chat history", value=False)
64
  max_new_tokens = gr.Slider(64, 1024, value=512, step=32, label="🔢 Max New Tokens")
65
 
66
- # Chat interface with working title
67
  chat = gr.ChatInterface(
68
  fn=lambda message, history: infer(message, history, enable_history.value, max_new_tokens.value),
69
  title="Gamunu 4B Instruct Alpha",
@@ -73,10 +73,7 @@ with gr.Blocks() as demo:
73
  ["රු. 250 කින් මිලදී ගත් දේ රු. 400 නම් එය ප්‍රතිශතයකින් කීයද වැඩි වී ඇත?"],
74
  ["ඔබ ගුරුවරයෙකු ලෙස ක්‍රියාකරන්න. ශිෂ්‍යයාට ඉතිහාසය උගන්වන්න."],
75
  ["ඔබ කවියෙකු ලෙස 'ගඟක්' ගැන කෙටි කවියක් ලියන්න."],
76
- ],
77
- retry_btn=None,
78
- undo_btn=None,
79
- clear_btn="🧹 Clear Chat",
80
  )
81
 
82
  gr.Markdown("""
 
29
  )
30
  model.eval()
31
 
32
+ # Add history only if enabled
33
  if enable_history and history:
34
  prev = "\n".join(
35
  [f"User: {h[0]}\nGamunu: {h[1]}" for h in history if h[1] is not None]
 
63
  enable_history = gr.Checkbox(label="Enable chat history", value=False)
64
  max_new_tokens = gr.Slider(64, 1024, value=512, step=32, label="🔢 Max New Tokens")
65
 
66
+ # Use only stable arguments (compatible everywhere)
67
  chat = gr.ChatInterface(
68
  fn=lambda message, history: infer(message, history, enable_history.value, max_new_tokens.value),
69
  title="Gamunu 4B Instruct Alpha",
 
73
  ["රු. 250 කින් මිලදී ගත් දේ රු. 400 නම් එය ප්‍රතිශතයකින් කීයද වැඩි වී ඇත?"],
74
  ["ඔබ ගුරුවරයෙකු ලෙස ක්‍රියාකරන්න. ශිෂ්‍යයාට ඉතිහාසය උගන්වන්න."],
75
  ["ඔබ කවියෙකු ලෙස 'ගඟක්' ගැන කෙටි කවියක් ලියන්න."],
76
+ ]
 
 
 
77
  )
78
 
79
  gr.Markdown("""