Python

August 3rd, 2024suno

歌词

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)

推荐歌曲

Rising from the Shadows
Rising from the Shadows

bass-heavy aggressive phonk

Empire of Oblivion
Empire of Oblivion

melodic solo powerful double bass drums high/medium tempo complex bass and riffs death metal low guitar tuning

Understand that you just have to fake it all even if hurt 💔
Understand that you just have to fake it all even if hurt 💔

Kpop, youthful, sad rhythm, with 7 male voices and that are warm, angelic, that give a feeling of having a broken up

adulting remix - but j-pop
adulting remix - but j-pop

80s j-pop, classical japanese vocals, anime intro

alone
alone

long-instrumental-intro, introspective smooth, fusion, synth-pop, inspiring moody, indie pop, nostalgic

Dance of Serenity
Dance of Serenity

Alternative R&B, Pop, Soul, Chillout, Trap, Male Vocalist, sad and slow

Tears of Tisha B'Av
Tears of Tisha B'Av

melancholic acoustic haunting

Los hombres lloran?
Los hombres lloran?

RBD style, Electronic, bright vocals, Spanish guitar, bubblegum beats,synths, catchy tones, repetitive beats.

Ardi Bali Suno
Ardi Bali Suno

kendang , violin, angklung, tapping guitar, drum band, orchestra, upbeat, uplifting, rhytmic, Vibrant, mandarin , emo

samu15
samu15

reggaeton flamenco melodic lo-fi

Synthheart Rhythms
Synthheart Rhythms

electronic,electronic dance music,eurodance,house,trance,euro house,techno,dance

Japari Quest Anthem
Japari Quest Anthem

female vocalist,j-pop,pop,melodic,television music,energetic,uplifting,happy

Carnevil
Carnevil

Solo grand piano and drums, metal style, haunting. very complex dark drama.

Melody of Me
Melody of Me

F♯/G♭ maj 180 BPM energetic, danceable 4/4 80s electric guitar drum electric bass keyboard distinctive voice

Hermosa Mujer
Hermosa Mujer

happy pop spanish guitar

أُغْنِيَّةُ الْحِجَابِ Song of The Veil
أُغْنِيَّةُ الْحِجَابِ Song of The Veil

heartfelt Arab Metal, BPM:180, Key:D minor, Arab female Rock voice, Arab scale, transient power, exciting drum fills