Spaces:
Sleeping
Sleeping
sergipastor
commited on
Commit
·
b72e3b4
1
Parent(s):
a4aaf76
first run
Browse files- app.py +25 -2
- models/discrete_token/lol.txt +0 -0
app.py
CHANGED
|
@@ -10,5 +10,28 @@ def greet_json():
|
|
| 10 |
|
| 11 |
@app.get("/generate")
|
| 12 |
def generate(arousal: float, valence: float):
|
| 13 |
-
subprocess.run(
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
@app.get("/generate")
|
| 12 |
def generate(arousal: float, valence: float):
|
| 13 |
+
resultado = subprocess.run(
|
| 14 |
+
[
|
| 15 |
+
'python',
|
| 16 |
+
'generate.py',
|
| 17 |
+
'--model_dir', 'discrete_token',
|
| 18 |
+
'--conditioning', 'discrete_token',
|
| 19 |
+
'--valence', str(valence),
|
| 20 |
+
'--arousal', str(arousal),
|
| 21 |
+
'--min_n_instruments', str(1),
|
| 22 |
+
'--batch_size', '1',
|
| 23 |
+
'--gen_len', str(64),
|
| 24 |
+
'--penalty_coeff', '-1'
|
| 25 |
+
],
|
| 26 |
+
capture_output=True, # Capture stdout and stderr
|
| 27 |
+
text=True, # Decode output as text
|
| 28 |
+
check=True # Raise an exception if the command fails
|
| 29 |
+
)
|
| 30 |
+
print(resultado)
|
| 31 |
+
return {"resultado": resultado}
|
| 32 |
+
|
| 33 |
+
@app.get("/show")
|
| 34 |
+
def show():
|
| 35 |
+
resultado = subprocess.run(["ls", "models/discrete_token"])
|
| 36 |
+
print(resultado)
|
| 37 |
+
return {}
|
models/discrete_token/lol.txt
DELETED
|
File without changes
|