Spaces:
Runtime error
Runtime error
Download app.py from wasmdashai/RunTasking: direct link, hf CLI and curl.
- Browser
- Download file 933 Bytes
-
https://huggingface.co/spaces/wasmdashai/RunTasking/resolve/2da45eae3c92be42ffb8bac2d6cc7ea0b0091bef/app.py
- Command line
-
hf download hf://spaces/wasmdashai/RunTasking@2da45eae3c92be42ffb8bac2d6cc7ea0b0091bef/app.py
-
curl -L -o app.py https://huggingface.co/spaces/wasmdashai/RunTasking/resolve/2da45eae3c92be42ffb8bac2d6cc7ea0b0091bef/app.py
933 Bytes
| import gradio as gr | |
| GK=0 | |
| from transformers import AutoTokenizer,VitsModel | |
| import torch | |
| import os | |
| token=os.environ.get("key_") | |
| tokenizer = AutoTokenizer.from_pretrained("wasmdashai/vits-ar-sa-huba",token=token) | |
| #device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| model_vits=VitsModel.from_pretrained("wasmdashai/vits-ar-sa-huba",token=token)#.to(device) | |
| def modelspeech(texts): | |
| inputs = tokenizer(texts, return_tensors="pt")#.cuda() | |
| wav = model_vits(input_ids=inputs["input_ids"]).waveform#.detach() | |
| # display(Audio(wav, rate=model.config.sampling_rate)) | |
| return model_vits.config.sampling_rate,wav#remove_noise_nr(wav) | |
| def greet(text,id): | |
| global GK | |
| b=int(id) | |
| while True: | |
| GK+=1 | |
| texts=[text]*b | |
| out=modelspeech(texts) | |
| yield f"namber is {GK}" | |
| demo = gr.Interface(fn=greet, inputs=["text","text"], outputs="text") | |
| demo.launch() | |