Spaces:
Running
on
Zero
Running
on
Zero
Helw150
commited on
Commit
•
987fe56
1
Parent(s):
7367b85
Loading
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ from transformers import AutoModel
|
|
17 |
from transformers.modeling_outputs import CausalLMOutputWithPast
|
18 |
|
19 |
orca = pvorca.create(access_key=os.environ.get("ORCA_KEY"))
|
20 |
-
|
21 |
if gr.NO_RELOAD:
|
22 |
diva_model = AutoModel.from_pretrained(
|
23 |
"WillHeld/DiVA-llama-3-v0-8b", trust_remote_code=True
|
@@ -73,7 +73,15 @@ def response(state: AppState, audio: tuple):
|
|
73 |
state.conversation.append(
|
74 |
{"role": "user", "content": {"path": file_name, "mime_type": "audio/wav"}}
|
75 |
)
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
yield state, state.conversation, None
|
78 |
if spaces.config.Config.zero_gpu:
|
79 |
if state.model_outs is not None:
|
@@ -96,6 +104,8 @@ def response(state: AppState, audio: tuple):
|
|
96 |
prev_outs=(prev_outs if prev_outs is not None else None),
|
97 |
):
|
98 |
prev_resp = state.conversation[-1]["content"]
|
|
|
|
|
99 |
state.conversation[-1]["content"] = resp
|
100 |
pcm = stream.synthesize(resp[len(prev_resp) :])
|
101 |
audio_chunk = None
|
|
|
17 |
from transformers.modeling_outputs import CausalLMOutputWithPast
|
18 |
|
19 |
orca = pvorca.create(access_key=os.environ.get("ORCA_KEY"))
|
20 |
+
LOADER_STR = "♫♪.ılılıll|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|llılılı.♫♪loading♫♪.ılılıll|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|llılılı.♫♪loading♫♪.ılılıll|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|llılılı.♫♪♫"
|
21 |
if gr.NO_RELOAD:
|
22 |
diva_model = AutoModel.from_pretrained(
|
23 |
"WillHeld/DiVA-llama-3-v0-8b", trust_remote_code=True
|
|
|
73 |
state.conversation.append(
|
74 |
{"role": "user", "content": {"path": file_name, "mime_type": "audio/wav"}}
|
75 |
)
|
76 |
+
gr.Warning(
|
77 |
+
"The first response might take a second to generate as DiVA is loaded from Disk to the ZeroGPU!"
|
78 |
+
)
|
79 |
+
state.conversation.append(
|
80 |
+
{
|
81 |
+
"role": "assistant",
|
82 |
+
"content": LOADER_STR,
|
83 |
+
}
|
84 |
+
)
|
85 |
yield state, state.conversation, None
|
86 |
if spaces.config.Config.zero_gpu:
|
87 |
if state.model_outs is not None:
|
|
|
104 |
prev_outs=(prev_outs if prev_outs is not None else None),
|
105 |
):
|
106 |
prev_resp = state.conversation[-1]["content"]
|
107 |
+
if prev_resp == LOADER_STR:
|
108 |
+
prev_resp = ""
|
109 |
state.conversation[-1]["content"] = resp
|
110 |
pcm = stream.synthesize(resp[len(prev_resp) :])
|
111 |
audio_chunk = None
|