berrkkaayy commited on
Commit
6bb339b
1 Parent(s): 5330866

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -12
app.py CHANGED
@@ -1,12 +1,19 @@
1
- import gradio as gr
2
- from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
3
-
4
- model = AutoModelForSequenceClassification.from_pretrained("savasy/bert-base-turkish-sentiment-cased")
5
- tokenizer = AutoTokenizer.from_pretrained("savasy/bert-base-turkish-sentiment-cased")
6
-
7
- def greet(text):
8
- pipe = pipeline("sentiment-analysis", tokenizer=tokenizer, model=model)
9
- return pipe(text)[0]['label']
10
-
11
- iface = gr.Interface(fn=greet, inputs=gr.inputs.Textbox(placeholder="Lütfen Cümle Giriniz...", lines=5), outputs="text")
12
- iface.launch(share=True)
 
 
 
 
 
 
 
 
1
+ from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
2
+ from fairseq.models.text_to_speech.hub_interface import TTSHubInterface
3
+ import IPython.display as ipd
4
+
5
+
6
+ models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
7
+ "facebook/tts_transformer-tr-cv7",
8
+ arg_overrides={"vocoder": "hifigan", "fp16": False}
9
+ )
10
+ model = models[0]
11
+ TTSHubInterface.update_cfg_with_data_cfg(cfg, task.data_cfg)
12
+ generator = task.build_generator(model, cfg)
13
+
14
+ text = "Merhaba, bu bir deneme çalışmasıdır."
15
+
16
+ sample = TTSHubInterface.get_model_input(task, text)
17
+ wav, rate = TTSHubInterface.get_prediction(task, model, generator, sample)
18
+
19
+ ipd.Audio(wav, rate=rate)