ehristoforu commited on
Commit
ca677a9
1 Parent(s): 3a6c43b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -15,7 +15,7 @@ def format_prompt(message, history):
15
  return prompt
16
 
17
  def generate(
18
- prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
19
  ):
20
  temperature = float(temperature)
21
  if temperature < 1e-2:
@@ -31,8 +31,7 @@ def generate(
31
  seed=42,
32
  )
33
 
34
- formatted_prompt = format_prompt(prompt, history)
35
-
36
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
37
  output = ""
38
 
@@ -43,6 +42,11 @@ def generate(
43
 
44
 
45
  additional_inputs=[
 
 
 
 
 
46
  gr.Slider(
47
  label="Temperature",
48
  value=0.9,
 
15
  return prompt
16
 
17
  def generate(
18
+ prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
19
  ):
20
  temperature = float(temperature)
21
  if temperature < 1e-2:
 
31
  seed=42,
32
  )
33
 
34
+ formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
 
35
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
36
  output = ""
37
 
 
42
 
43
 
44
  additional_inputs=[
45
+ gr.Textbox(
46
+ label="System Prompt",
47
+ max_lines=1,
48
+ interactive=True,
49
+ ),
50
  gr.Slider(
51
  label="Temperature",
52
  value=0.9,