Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,12 +21,16 @@ snapshot_download(repo_id="jzq11111/mooncast", local_dir='./resources/')
|
|
| 21 |
from inference import Model
|
| 22 |
import base64
|
| 23 |
|
| 24 |
-
model = Model()
|
| 25 |
-
model.generate_config.max_new_tokens = 50 * 50 # no more than 20s per turn
|
|
|
|
| 26 |
|
| 27 |
@spaces.GPU(duration=120)
|
| 28 |
def process_json_and_generate_audio(prompt_audio_role0_file, prompt_text_role0, prompt_audio_role1_file, prompt_text_role1, json_dialogue_input_str):
|
| 29 |
try:
|
|
|
|
|
|
|
|
|
|
| 30 |
print(json_dialogue_input_str, type(json_dialogue_input_str))
|
| 31 |
print(prompt_audio_role0_file, prompt_text_role0, prompt_audio_role1_file, prompt_text_role1)
|
| 32 |
# json_data = json.loads(json_dialogue_input_str)
|
|
|
|
| 21 |
from inference import Model
|
| 22 |
import base64
|
| 23 |
|
| 24 |
+
# model = Model()
|
| 25 |
+
# model.generate_config.max_new_tokens = 50 * 50 # no more than 20s per turn
|
| 26 |
+
model = None
|
| 27 |
|
| 28 |
@spaces.GPU(duration=120)
|
| 29 |
def process_json_and_generate_audio(prompt_audio_role0_file, prompt_text_role0, prompt_audio_role1_file, prompt_text_role1, json_dialogue_input_str):
|
| 30 |
try:
|
| 31 |
+
if model is None:
|
| 32 |
+
model = Model()
|
| 33 |
+
model.generate_config.max_new_tokens = 50 * 50 # no more than 20s per turn
|
| 34 |
print(json_dialogue_input_str, type(json_dialogue_input_str))
|
| 35 |
print(prompt_audio_role0_file, prompt_text_role0, prompt_audio_role1_file, prompt_text_role1)
|
| 36 |
# json_data = json.loads(json_dialogue_input_str)
|