Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ proc_model = AutoModelForCausalLM.from_pretrained(
|
|
21 |
torch_dtype=torch.float16,
|
22 |
revision="653ee820c4f2ee66427e997b4a8ca3e9323e7d46",
|
23 |
trust_remote_code=True,
|
24 |
-
low_cpu_mem_usage=True,
|
25 |
)
|
26 |
|
27 |
proc_model.to("cpu")
|
@@ -105,8 +105,6 @@ def transcribe(audio_filepath):
|
|
105 |
|
106 |
start = {"role": "system", "content": "You are a helpful digital assistant. Please provide safe, ethical and accurate information to the user."}
|
107 |
|
108 |
-
|
109 |
-
|
110 |
def generate_response(user_input):
|
111 |
messages = [start, {"role": "user", "content": user_input}]
|
112 |
inputs = proc_tokenizer.apply_chat_template(
|
@@ -135,7 +133,7 @@ def CanaryPhiVits(user_voice):
|
|
135 |
response = generate_response(user_input)
|
136 |
print(response)
|
137 |
if response.startswith(user_input):
|
138 |
-
response =
|
139 |
print(response)
|
140 |
chatty_response = text_to_speech(response)
|
141 |
|
|
|
21 |
torch_dtype=torch.float16,
|
22 |
revision="653ee820c4f2ee66427e997b4a8ca3e9323e7d46",
|
23 |
trust_remote_code=True,
|
24 |
+
#low_cpu_mem_usage=True,
|
25 |
)
|
26 |
|
27 |
proc_model.to("cpu")
|
|
|
105 |
|
106 |
start = {"role": "system", "content": "You are a helpful digital assistant. Please provide safe, ethical and accurate information to the user."}
|
107 |
|
|
|
|
|
108 |
def generate_response(user_input):
|
109 |
messages = [start, {"role": "user", "content": user_input}]
|
110 |
inputs = proc_tokenizer.apply_chat_template(
|
|
|
133 |
response = generate_response(user_input)
|
134 |
print(response)
|
135 |
if response.startswith(user_input):
|
136 |
+
response = response.replace(user_input, '', 1)
|
137 |
print(response)
|
138 |
chatty_response = text_to_speech(response)
|
139 |
|