Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ def transcribe(audio):
|
|
16 |
|
17 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
18 |
|
19 |
-
system_instructions = "[SYSTEM] You are CrucialCoach, an AI-powered conversational coach
|
20 |
|
21 |
@spaces.GPU(duration=120)
|
22 |
def model(text):
|
@@ -28,7 +28,6 @@ def model(text):
|
|
28 |
do_sample=True,
|
29 |
seed=42,
|
30 |
)
|
31 |
-
|
32 |
formatted_prompt = system_instructions + text + "[CrucialCoach]"
|
33 |
stream = client.text_generation(
|
34 |
formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
@@ -36,7 +35,6 @@ def model(text):
|
|
36 |
for response in stream:
|
37 |
if not response.token.text == "</s>":
|
38 |
output += response.token.text
|
39 |
-
|
40 |
return output
|
41 |
|
42 |
async def respond(audio):
|
@@ -48,7 +46,10 @@ async def respond(audio):
|
|
48 |
await communicate.save(tmp_path)
|
49 |
return tmp_path
|
50 |
|
51 |
-
|
|
|
|
|
|
|
52 |
with gr.Row():
|
53 |
input = gr.Audio(label="Voice Chat", sources="microphone", type="filepath", waveform_options=False)
|
54 |
output = gr.Audio(label="CrucialCoach", type="filepath", interactive=False, autoplay=True)
|
@@ -61,11 +62,5 @@ with gr.Blocks() as voice:
|
|
61 |
title="Voice Chat"
|
62 |
)
|
63 |
|
64 |
-
theme = gr.themes.Base()
|
65 |
-
|
66 |
-
with gr.Blocks(theme=theme, css="footer {visibility: hidden}textbox{resize:none}", title="CrucialCoach DEMO") as demo:
|
67 |
-
gr.Markdown("# CrucialCoach")
|
68 |
-
voice.render()
|
69 |
-
|
70 |
demo.queue(max_size=200)
|
71 |
demo.launch()
|
|
|
16 |
|
17 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
18 |
|
19 |
+
system_instructions = "[SYSTEM] You are CrucialCoach, an AI-powered conversational coach. Guide the user through challenging workplace situations using the principles from 'Crucial Conversations'. Ask one question at a time and provide step-by-step guidance.\n\n[USER]"
|
20 |
|
21 |
@spaces.GPU(duration=120)
|
22 |
def model(text):
|
|
|
28 |
do_sample=True,
|
29 |
seed=42,
|
30 |
)
|
|
|
31 |
formatted_prompt = system_instructions + text + "[CrucialCoach]"
|
32 |
stream = client.text_generation(
|
33 |
formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
35 |
for response in stream:
|
36 |
if not response.token.text == "</s>":
|
37 |
output += response.token.text
|
|
|
38 |
return output
|
39 |
|
40 |
async def respond(audio):
|
|
|
46 |
await communicate.save(tmp_path)
|
47 |
return tmp_path
|
48 |
|
49 |
+
theme = gr.themes.Base()
|
50 |
+
|
51 |
+
with gr.Blocks(theme=theme, css="footer {visibility: hidden}textbox{resize:none}", title="CrucialCoach DEMO") as demo:
|
52 |
+
gr.Markdown("# CrucialCoach")
|
53 |
with gr.Row():
|
54 |
input = gr.Audio(label="Voice Chat", sources="microphone", type="filepath", waveform_options=False)
|
55 |
output = gr.Audio(label="CrucialCoach", type="filepath", interactive=False, autoplay=True)
|
|
|
62 |
title="Voice Chat"
|
63 |
)
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
demo.queue(max_size=200)
|
66 |
demo.launch()
|