naonauno commited on
Commit
4e1b21a
·
verified ·
1 Parent(s): 587ecd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -59,8 +59,10 @@ class MissionGenerator:
59
  outputs = self.model.generate(
60
  inputs["input_ids"],
61
  max_length=256,
62
- num_beams=4,
63
- temperature=0.7,
 
 
64
  no_repeat_ngram_size=2
65
  )
66
 
@@ -92,7 +94,8 @@ def create_gradio_interface():
92
 
93
  def process_input(user_input: str, history: List[Dict]) -> tuple[List[Dict], str]:
94
  chat_response, formatted_output = generator.generate_response(user_input)
95
- history.append({"user": user_input, "bot": chat_response})
 
96
  return history, formatted_output
97
 
98
  with gr.Blocks() as interface:
 
59
  outputs = self.model.generate(
60
  inputs["input_ids"],
61
  max_length=256,
62
+ do_sample=True, # Enable sampling
63
+ temperature=0.7, # Control randomness
64
+ top_p=0.9, # Nucleus sampling
65
+ num_beams=4, # Beam search
66
  no_repeat_ngram_size=2
67
  )
68
 
 
94
 
95
  def process_input(user_input: str, history: List[Dict]) -> tuple[List[Dict], str]:
96
  chat_response, formatted_output = generator.generate_response(user_input)
97
+ history.append({"role": "user", "content": user_input})
98
+ history.append({"role": "assistant", "content": chat_response})
99
  return history, formatted_output
100
 
101
  with gr.Blocks() as interface: