gorkemgoknar commited on
Commit
1abd8a4
1 Parent(s): ee0e203

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -14,8 +14,8 @@ import numpy as np
14
  from TTS.utils.manage import ModelManager
15
  from TTS.utils.synthesizer import Synthesizer
16
 
17
- emotion_tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-emotion")
18
- emotion_model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-emotion")
19
 
20
  def get_emotion(text):
21
  input_ids = tokenizer.encode(text + '</s>', return_tensors='pt')
@@ -131,7 +131,7 @@ def greet(character,your_voice,message,history):
131
 
132
  history["message_history"].append((message, response))
133
 
134
- emotion = get_emotion(response)
135
 
136
  html = "<div class='chatbot'>"
137
  for user_msg, resp_msg in history["message_history"]:
@@ -139,7 +139,7 @@ def greet(character,your_voice,message,history):
139
  html += f"<div class='resp_msg'>{character}: {resp_msg}</div>"
140
  html += "</div>"
141
 
142
- return "tts_output.wav",emotion, html,history
143
 
144
 
145
 
@@ -169,7 +169,7 @@ examples=[['Gandalf','Hello','dragon.wav']]
169
  history = {"character": "None", "message_history" : [] }
170
  interface= gr.Interface(fn=greet,
171
  inputs=[gr.inputs.Dropdown(personality_choices),gr.inputs.Audio(source="microphone", type="filepath") ,"text", "state"],
172
- outputs=[gr.outputs.Audio(type="file"),"text","html","state"],
173
  css=css, title=title, description=description,article=article )
174
 
175
 
 
14
  from TTS.utils.manage import ModelManager
15
  from TTS.utils.synthesizer import Synthesizer
16
 
17
+ #emotion_tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-emotion")
18
+ #emotion_model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-emotion")
19
 
20
  def get_emotion(text):
21
  input_ids = tokenizer.encode(text + '</s>', return_tensors='pt')
 
131
 
132
  history["message_history"].append((message, response))
133
 
134
+ #emotion = get_emotion(response)
135
 
136
  html = "<div class='chatbot'>"
137
  for user_msg, resp_msg in history["message_history"]:
 
139
  html += f"<div class='resp_msg'>{character}: {resp_msg}</div>"
140
  html += "</div>"
141
 
142
+ return "tts_output.wav", html,history
143
 
144
 
145
 
 
169
  history = {"character": "None", "message_history" : [] }
170
  interface= gr.Interface(fn=greet,
171
  inputs=[gr.inputs.Dropdown(personality_choices),gr.inputs.Audio(source="microphone", type="filepath") ,"text", "state"],
172
+ outputs=[gr.outputs.Audio(type="file"),"html","state"],
173
  css=css, title=title, description=description,article=article )
174
 
175