Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,8 @@ model = ParlerTTSForConditionalGeneration.from_pretrained(
|
|
27 |
jenny_repo_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
|
28 |
).to(device)
|
29 |
|
30 |
-
client = InferenceClient(token=os.getenv("HF_TOKEN"))
|
|
|
31 |
|
32 |
tokenizer = AutoTokenizer.from_pretrained(repo_id)
|
33 |
feature_extractor = AutoFeatureExtractor.from_pretrained(repo_id)
|
@@ -37,6 +38,7 @@ SEED = 42
|
|
37 |
|
38 |
|
39 |
def numpy_to_mp3(audio_array, sampling_rate):
|
|
|
40 |
# Normalize audio_array if it's floating-point
|
41 |
if np.issubdtype(audio_array.dtype, np.floating):
|
42 |
max_val = np.max(np.abs(audio_array))
|
@@ -66,27 +68,30 @@ frame_rate = model.audio_encoder.config.frame_rate
|
|
66 |
|
67 |
|
68 |
def generate_response(audio):
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
78 |
|
79 |
-
response = client.chat_completion(messages, max_tokens=64, seed=random.randint(1, 5000), model="mistralai/Mistral-7B-Instruct-v0.3")
|
80 |
-
response = response.choices[0].message.content.replace("Magic 8 Ball", "")
|
81 |
-
return response, None, None
|
|
|
82 |
|
83 |
@spaces.GPU
|
84 |
def read_response(answer):
|
|
|
85 |
|
86 |
play_steps_in_s = 2.0
|
87 |
play_steps = int(frame_rate * play_steps_in_s)
|
88 |
|
89 |
-
description = "Jenny speaks at an
|
90 |
description_tokens = tokenizer(description, return_tensors="pt").to(device)
|
91 |
|
92 |
streamer = ParlerTTSStreamer(model, device=device, play_steps=play_steps)
|
@@ -113,7 +118,7 @@ def read_response(answer):
|
|
113 |
with gr.Blocks() as block:
|
114 |
gr.HTML(
|
115 |
f"""
|
116 |
-
<h1 style='text-align: center;'>
|
117 |
<h3 style='text-align: center;'> Ask a question and receive wisdom </h3>
|
118 |
<p style='text-align: center;'> Powered by <a href="https://github.com/huggingface/parler-tts"> Parler-TTS</a>
|
119 |
"""
|
|
|
27 |
jenny_repo_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True
|
28 |
).to(device)
|
29 |
|
30 |
+
# client = InferenceClient(token=os.getenv("HF_TOKEN"))
|
31 |
+
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(repo_id)
|
34 |
feature_extractor = AutoFeatureExtractor.from_pretrained(repo_id)
|
|
|
38 |
|
39 |
|
40 |
def numpy_to_mp3(audio_array, sampling_rate):
|
41 |
+
print("Converting numpy array to MP3...")
|
42 |
# Normalize audio_array if it's floating-point
|
43 |
if np.issubdtype(audio_array.dtype, np.floating):
|
44 |
max_val = np.max(np.abs(audio_array))
|
|
|
68 |
|
69 |
|
70 |
def generate_response(audio):
|
71 |
+
print("Generating response...")
|
72 |
+
# gr.Info("Transcribing Audio", duration=5)
|
73 |
+
# question = client.automatic_speech_recognition(audio).text
|
74 |
+
# messages = [{"role": "system", "content": ("You are a magic 8 ball."
|
75 |
+
# "Someone will present to you a situation or question and your job "
|
76 |
+
# "is to answer with a cryptic addage or proverb such as "
|
77 |
+
# "'curiosity killed the cat' or 'The early bird gets the worm'."
|
78 |
+
# "Keep your answers short and do not include the phrase 'Magic 8 Ball' in your response. If the question does not make sense or is off-topic, say 'Foolish questions get foolish answers.'"
|
79 |
+
# "For example, 'Magic 8 Ball, should I get a dog?', 'A dog is ready for you but are you ready for the dog?'")},
|
80 |
+
# {"role": "user", "content": f"Magic 8 Ball please answer this question - {question}"}]
|
81 |
|
82 |
+
# response = client.chat_completion(messages, max_tokens=64, seed=random.randint(1, 5000), model="mistralai/Mistral-7B-Instruct-v0.3")
|
83 |
+
# response = response.choices[0].message.content.replace("Magic 8 Ball", "")
|
84 |
+
# return response, None, None
|
85 |
+
return "I feel myself beginning to build in anticipation that you are about to release from me, my pussy dripping wet again. As I continue to rock I feel you grab a fistful of my hair and shove your cock deep into my throat. It takes a few minutes of you throat fucking and choking for me to begin screaming around your cock, which elicits an evil chuckle. Soon your breathing has returned to normal, I feel you get up off of me, leaving me there, breathless and breathing.", None, None
|
86 |
|
87 |
@spaces.GPU
|
88 |
def read_response(answer):
|
89 |
+
print("Reading response...")
|
90 |
|
91 |
play_steps_in_s = 2.0
|
92 |
play_steps = int(frame_rate * play_steps_in_s)
|
93 |
|
94 |
+
description = "Jenny speaks at an a slow pace pace and sometiems breaths deeply with a erotic voice and tries to turn man on in a very confined sounding environment with clear audio quality."
|
95 |
description_tokens = tokenizer(description, return_tensors="pt").to(device)
|
96 |
|
97 |
streamer = ParlerTTSStreamer(model, device=device, play_steps=play_steps)
|
|
|
118 |
with gr.Blocks() as block:
|
119 |
gr.HTML(
|
120 |
f"""
|
121 |
+
<h1 style='text-align: center;'>Erotic 🎱 </h1>
|
122 |
<h3 style='text-align: center;'> Ask a question and receive wisdom </h3>
|
123 |
<p style='text-align: center;'> Powered by <a href="https://github.com/huggingface/parler-tts"> Parler-TTS</a>
|
124 |
"""
|