Python

August 3rd, 2024suno

Lyrics

from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///functions.db' db = SQLAlchemy(app) CORS(app) class Function(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) description = db.Column(db.String(200), nullable=False) language = db.Column(db.String(100), nullable=False) with app.app_context(): db.create_all() @app.route('/api/functions', methods=['GET']) def get_functions(): functions = Function.query.all() results = [ { 'id': func.id, 'name': func.name, 'description': func.description, 'language': func.language } for func in functions ] return jsonify(results) @app.route('/api/functions/search', methods=['GET']) def search_functions(): query = request.args.get('query', '') language = request.args.get('language', '') functions = Function.query.filter( Function.description.ilike(f'%{query}%'), Function.language.ilike(f'%{language}%') ).all() results = [ { 'id': func.id, 'name': func.name, 'description': func.description, 'language': func.language } for func in functions ] return jsonify(results) @app.route('/api/functions', methods=['POST']) def add_function(): data = request.get_json() if 'name' not in data or 'description' not in data or 'language' not in data: return jsonify({'error': 'Bad Request', 'message': 'Missing name or description or language'}), 400 new_function = Function(name=data['name'], description=data['description'], language=data['language']) db.session.add(new_function) db.session.commit() return jsonify({'message': 'Function added'}), 201 @app.route('/api/functions/<int:id>', methods=['DELETE']) def delete_function(id): function = Function.query.get_or_404(id) db.session.delete(function) db.session.commit() return jsonify({'message': 'Function deleted'}) if __name__ == '__main__': app.run(debug=True)

Recommended

Shimmy, Shimmy, Shimmy
Shimmy, Shimmy, Shimmy

male vocalist,hip hop,pop rap,contemporary r&b,r&b,alternative r&b,boastful,introspective,melodic,atmospheric,breakup,mellow

Fiery Gaze (Many Languages)
Fiery Gaze (Many Languages)

Male Vocals, Electronic with synthwave, R&B elements and pop, electropop

행복의 날들
행복의 날들

cheerful pop

Busy Heart
Busy Heart

acoustic pop reflective

《闭眼入梦》 - "Eyes Closed, Dreaming."
《闭眼入梦》 - "Eyes Closed, Dreaming."

Ambient, Lullaby, Relaxing, Synthesizer, Calming Vocals, Scene of Sleep and Tranquility

Koto
Koto

koto, oriental japanese music, harbass

Whisper of the Shadows
Whisper of the Shadows

percussion-driven spoken word ambient

Roller Coaster Love
Roller Coaster Love

serene,peaceful,new-age,piano

Endless Love
Endless Love

pop melodic

Royal Crowns
Royal Crowns

grandiose majestic instrumental rap beat

Broken Fantasy (Rap ver.) 2.0
Broken Fantasy (Rap ver.) 2.0

introspective emotional rap, Key:A#/B♭ Major, Camelot:6B, male voice

Muktir Gaan B
Muktir Gaan B

Based on indian classical music, male voice, female voice, ambient, romantic, cinematic

Squid
Squid

metal , Punk Rock , Hardcore, rap , mixture , death metal vocal

Do You Remember?
Do You Remember?

piano, violin, female singer, soft voice, k-pop

1/2 pisces
1/2 pisces

indonesia indie, acoustic, guitar, bass, male voice, romantic, sad

Ballad of the Adventurers
Ballad of the Adventurers

pop,traditional pop,show tunes,musical theater and entertainment,standards,music hall,comedy,broadway

Tales of Dragonsong
Tales of Dragonsong

video game orchestral 16 bit

House of the rising sun
House of the rising sun

117 bpm, A minor, Organ, 1960s, Soulful male Vocals