PX200O commited on
Commit
149c7a4
·
verified ·
1 Parent(s): dab60e9

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +4 -4
README.md CHANGED
@@ -15,6 +15,7 @@ pinned: false
15
  This Space exposes Text2MIDI generation from text prompts.
16
 
17
  Model source:
18
- - `PX200O/midi`
 
19
 
20
  Use the UI to generate and download a MIDI file.
 
15
  This Space exposes Text2MIDI generation from text prompts.
16
 
17
  Model source:
18
+ - `amaai-lab/text2midi` (weights)
19
+ - Space code owned by `PX200O/text2midi-api`
20
 
21
  Use the UI to generate and download a MIDI file.
app.py CHANGED
@@ -12,7 +12,7 @@ from transformers import T5Tokenizer
12
  from model.transformer_model import Transformer
13
 
14
 
15
- MODEL_REPO_ID = os.environ.get("MODEL_REPO_ID", "PX200O/midi")
16
 
17
 
18
  def get_device() -> str:
@@ -34,8 +34,8 @@ def load_once() -> None:
34
  if r_tokenizer is not None and model is not None:
35
  return
36
 
37
- model_path = hf_hub_download(repo_id=MODEL_REPO_ID, filename="artifacts/model.bin")
38
- vocab_path = hf_hub_download(repo_id=MODEL_REPO_ID, filename="artifacts/vocab_remi.pkl")
39
 
40
  with open(vocab_path, "rb") as f:
41
  r_tokenizer = pickle.load(f)
@@ -88,4 +88,4 @@ with gr.Blocks() as demo:
88
 
89
 
90
  if __name__ == "__main__":
91
- demo.queue().launch()
 
12
  from model.transformer_model import Transformer
13
 
14
 
15
+ MODEL_REPO_ID = os.environ.get("MODEL_REPO_ID", "amaai-lab/text2midi")
16
 
17
 
18
  def get_device() -> str:
 
34
  if r_tokenizer is not None and model is not None:
35
  return
36
 
37
+ model_path = hf_hub_download(repo_id=MODEL_REPO_ID, filename="pytorch_model.bin")
38
+ vocab_path = hf_hub_download(repo_id=MODEL_REPO_ID, filename="vocab_remi.pkl")
39
 
40
  with open(vocab_path, "rb") as f:
41
  r_tokenizer = pickle.load(f)
 
88
 
89
 
90
  if __name__ == "__main__":
91
+ demo.queue().launch(share=True)