Anita-19 commited on
Commit
6c39073
Β·
verified Β·
1 Parent(s): 30972f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -1,4 +1,26 @@
1
- import librosa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  import soundfile as sf
4
 
@@ -64,4 +86,4 @@ iface = gr.Interface(
64
  )
65
 
66
  # Launch Gradio interface
67
- iface.launch()
 
1
+ """Set up the Gradio interface"""
2
+
3
+ import gradio as gr
4
+ from transformers import pipeline
5
+ from TTS.api import TTS
6
+
7
+ # Load pre-trained emotion detection model
8
+ emotion_classifier = pipeline("text-classification", model="bhadresh-savani/distilbert-base-uncased-emotion")
9
+
10
+ # Load TTS model
11
+ tts_model = TTS(model_name="tts_models/en/ljspeech/tacotron2-DDC")
12
+
13
+ # Emotion-specific settings for pitch and speed
14
+ emotion_settings = {
15
+ "neutral": {"pitch": 1.0, "speed": 1.0},
16
+ "joy": {"pitch": 1.3, "speed": 1.2},
17
+ "sadness": {"pitch": 0.8, "speed": 0.9},
18
+ "anger": {"pitch": 1.6, "speed": 1.4},
19
+ "fear": {"pitch": 1.2, "speed": 0.95},
20
+ "surprise": {"pitch": 1.5, "speed": 1.3},
21
+ "disgust": {"pitch": 0.9, "speed": 0.95},
22
+ "shame": {"pitch": 0.8, "speed": 0.85},
23
+ }
24
 
25
  import soundfile as sf
26
 
 
86
  )
87
 
88
  # Launch Gradio interface
89
+ iface.launch()