Sephfox commited on
Commit
3a91b6e
·
verified ·
1 Parent(s): 93bbf6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -64,6 +64,9 @@ response_model_name = "microsoft/DialoGPT-medium"
64
  response_tokenizer = AutoTokenizer.from_pretrained(response_model_name)
65
  response_model = AutoModelForCausalLM.from_pretrained(response_model_name)
66
 
 
 
 
67
  # Enhanced Emotional States
68
  emotions = {
69
  'joy': {'percentage': 10, 'motivation': 'positive', 'intensity': 0},
@@ -148,7 +151,6 @@ def evolve_emotions():
148
  total = sum(e['percentage'] for e in emotions.values())
149
  for e in emotions:
150
  emotions[e]['percentage'] = (emotions[e]['percentage'] / total) * 100
151
-
152
  def update_emotion_history(emotion, percentage, intensity, context):
153
  entry = {
154
  'emotion': emotion,
@@ -198,7 +200,8 @@ def generate_response(input_text, ai_emotion):
198
  do_sample=True,
199
  top_k=50,
200
  top_p=0.95,
201
- temperature=temperature
 
202
  )
203
  response = response_tokenizer.decode(response_ids[0], skip_special_tokens=True)
204
 
@@ -326,4 +329,4 @@ iface = gr.Interface(
326
  )
327
 
328
  if __name__ == "__main__":
329
- iface.launch(share=True)
 
64
  response_tokenizer = AutoTokenizer.from_pretrained(response_model_name)
65
  response_model = AutoModelForCausalLM.from_pretrained(response_model_name)
66
 
67
+ # Set the pad token
68
+ response_tokenizer.pad_token = response_tokenizer.eos_token
69
+
70
  # Enhanced Emotional States
71
  emotions = {
72
  'joy': {'percentage': 10, 'motivation': 'positive', 'intensity': 0},
 
151
  total = sum(e['percentage'] for e in emotions.values())
152
  for e in emotions:
153
  emotions[e]['percentage'] = (emotions[e]['percentage'] / total) * 100
 
154
  def update_emotion_history(emotion, percentage, intensity, context):
155
  entry = {
156
  'emotion': emotion,
 
200
  do_sample=True,
201
  top_k=50,
202
  top_p=0.95,
203
+ temperature=temperature,
204
+ pad_token_id=response_tokenizer.eos_token_id
205
  )
206
  response = response_tokenizer.decode(response_ids[0], skip_special_tokens=True)
207
 
 
329
  )
330
 
331
  if __name__ == "__main__":
332
+ iface.launch(share=True)