KingNish commited on
Commit
336ed2f
1 Parent(s): 822036b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -10,22 +10,23 @@ system_instructions = "You will be provided with text, and your task is to class
10
  def classify_task(prompt):
11
  generate_kwargs = dict(
12
  temperature=0.5,
13
- max_new_tokens=1024,
14
- top_p=0.95,
15
- repetition_penalty=1.0,
16
  do_sample=True,
17
  seed=42,
18
  )
19
 
20
- formatted_prompt = system_instructions + prompt + "[/INST]"
21
  stream = client.text_generation(
22
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
23
  output = ""
24
 
25
  for response in stream:
26
- output += response.token.text
27
- yield output
28
- return output
 
29
 
30
  # Create the Gradio interface
31
  with gr.Blocks() as demo:
 
10
  def classify_task(prompt):
11
  generate_kwargs = dict(
12
  temperature=0.5,
13
+ max_new_tokens=5,
14
+ top_p=0.7,
15
+ repetition_penalty=1.2,
16
  do_sample=True,
17
  seed=42,
18
  )
19
 
20
+ formatted_prompt = system_instructions + prompt
21
  stream = client.text_generation(
22
  formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
23
  output = ""
24
 
25
  for response in stream:
26
+ if not response.token.text == "</s>":
27
+ output += response.token.text
28
+
29
+ return output
30
 
31
  # Create the Gradio interface
32
  with gr.Blocks() as demo: