adding checks
Browse files
app.py
CHANGED
@@ -119,6 +119,13 @@ def predict_batched(texts, melodies):
|
|
119 |
def predict_full(model, text, melody, duration, topk, topp, temperature, cfg_coef, progress=gr.Progress()):
|
120 |
global INTERRUPTING
|
121 |
INTERRUPTING = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
topk = int(topk)
|
123 |
load_model(model)
|
124 |
|
|
|
119 |
def predict_full(model, text, melody, duration, topk, topp, temperature, cfg_coef, progress=gr.Progress()):
|
120 |
global INTERRUPTING
|
121 |
INTERRUPTING = False
|
122 |
+
if temperature < 0:
|
123 |
+
raise gr.Error("Temperature must be >= 0.")
|
124 |
+
if topk < 0:
|
125 |
+
raise gr.Error("Topk must be non-negative.")
|
126 |
+
if topp < 0:
|
127 |
+
raise gr.Error("Topp must be non-negative.")
|
128 |
+
|
129 |
topk = int(topk)
|
130 |
load_model(model)
|
131 |
|