Spaces:
Runtime error
Runtime error
Update app.py
Browse files13 unmodified lines141516171819204 unmodified lines25262728293086 unmodified lines11711811912012112212312412511 unmodified lines13713813914014114214314413 unmodified linesconfig = load_config()# Initialize the Inference Client with GPT-Neo modelclient = InferenceClient("EleutherAI/gpt-neo-1.3B") # You can replace this with another model if desired# List of house music hooks to drop randomlyhouse_music_hooks = [4 unmodified lines"Dancing is what to do!""Let's get riggity riggity wrecked!""Sleep is for the week, not the weekend!""Jack to the sound of the underground!""Jack your body!""Dancing all night long, can't stop the beat!",86 unmodified linesguided_prompt = f"Yo, what’s up? You’re talking to an old-school raver who’s all about house music, good vibes, and funky beats. Let’s keep it groovy, laid-back, and full of love!\n{prompt}"try:response = client.text_completion(prompt=guided_prompt, max_new_tokens=config['max_tokens'], temperature=config['temperature'])return random.choice(house_music_hooks) + " " + response['generated_text']except Exception as e:print(f"Error querying GPT-Neo model: {e}")return "Sorry, I’m too hyped to respond right now!"11 unmodified linesasync def event_message(self, message):"""Event handler when a message is received in chat."""if message.author.name.lower() == self.nick.lower():return # Ignore the bot's own messagesprint(f"Message received: {message.content} from {message.author.name}")13 unmodified lines141516171819204 unmodified lines2526272829303132333435363738394086 unmodified lines12712812913013113213313413513613713813914014114214314414514614714814915015111 unmodified lines16316416516616716816917017113 unmodified linesconfig = load_config()# Initialize the Inference Client with GPT-Neo modelclient = InferenceClient(model="EleutherAI/gpt-neo-1.3B") # Correct InferenceClient setup# List of house music hooks to drop randomlyhouse_music_hooks = [4 unmodified lines"Dancing is what to do!""Let's get riggity riggity wrecked!""Sleep is for the week, not the weekend!""It's hard out here for a pimp!""Something for your mind!""Something for your body!""Something for your soul!""Not everyone understands this thing they call house music!""It's a spiritual thing!""Talkin' about that thing they call house music!""Don't mean a thing if it ain't got that swing!""Can't stop. Won't stop!""Shots! Shots! Shots!""Jack to the sound of the underground!""Jack your body!""Dancing all night long, can't stop the beat!",86 unmodified linesguided_prompt = f"Yo, what’s up? You’re talking to an old-school raver who’s all about house music, good vibes, and funky beats. Let’s keep it groovy, laid-back, and full of love!\n{prompt}"try:# Debug: Print the prompt being sentprint(f"Sending prompt: {guided_prompt}")# Correct API call to Hugging Faceresponse = client.text_generation(model="EleutherAI/gpt-neo-1.3B", # Specify the model nameinputs=guided_prompt, # The prompt we're sendingmax_new_tokens=config['max_tokens'],temperature=config['temperature'])# Debug: Print the raw response from Hugging Faceprint(f"Received response: {response}")# Get the text part of the response and return it with a random house music hookresult = response['generated_text']return random.choice(house_music_hooks) + " " + resultexcept Exception as e:# Print the error for debuggingprint(f"Error querying GPT-Neo model: {e}")return "Sorry, I’m too hyped to respond right now!"11 unmodified linesasync def event_message(self, message):"""Event handler when a message is received in chat."""# Ensure message.author is not Noneif message.author is None or message.author.name.lower() == self.nick.lower():return # Ignore the bot's own messages or if author is Noneprint(f"Message received: {message.content} from {message.author.name}")
app.py+32-5