Corianas commited on
Commit
01a82e4
·
1 Parent(s): 420c094

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -89,8 +89,7 @@ def get_model_list():
89
  model_files = [f for f in model_files if f.endswith('.pt')]
90
  return model_files
91
 
92
- def gen(input, model_name):
93
- model = load_model(model_name)
94
  generated_text = ''
95
  start_ids = encode(add_caseifer(input))
96
  x = (torch.tensor(start_ids, dtype=torch.long, device=device)[None, ...])
@@ -117,7 +116,7 @@ with gr.Blocks() as demo:
117
  def bot(history):
118
  # Generate the bot's response using your model
119
  input_text = history[-1][0]
120
- bot_message = gen(input_text, model)
121
 
122
  history[-1][1] = ""
123
  for character in bot_message:
 
89
  model_files = [f for f in model_files if f.endswith('.pt')]
90
  return model_files
91
 
92
+ def gen(input):
 
93
  generated_text = ''
94
  start_ids = encode(add_caseifer(input))
95
  x = (torch.tensor(start_ids, dtype=torch.long, device=device)[None, ...])
 
116
  def bot(history):
117
  # Generate the bot's response using your model
118
  input_text = history[-1][0]
119
+ bot_message = gen(input_text)
120
 
121
  history[-1][1] = ""
122
  for character in bot_message: