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

Yvonne's Song
Yvonne's Song

heartfelt

Georgia Soulfire
Georgia Soulfire

Southern Rock

Magyar Péter a megváltó
Magyar Péter a megváltó

poetic rhythmic pop

Remember Those Days
Remember Those Days

Country, heartfelt, acoustic, acoustic guitar, nostalgic

Rival's Anthem
Rival's Anthem

rebellious rock

Suno Please Fix
Suno Please Fix

electro-swing-step, step step-step, swinging-goth-rave-step-step, electro-wing

Critical
Critical

instrumental, math rock, djent, progressive metal, complex, experimental, heavy, dark, chill

Жас қазағым
Жас қазағым

Азия стил

Il Primo Passo: Un Viaggio d'Amore
Il Primo Passo: Un Viaggio d'Amore

male romantic pop ballad

Homecoming
Homecoming

Darksynth, Synthwave, French electro, Italo disco revival, Progressive metal

Are we live in end time,
Are we live in end time,

acoustic 12 string guitar ,Mellotron , slow Psychedelic Rock, synthesizers and . sequencers , Temp 88 vocoder.

X Love
X Love

Female voice,

Bu Gece Bizim
Bu Gece Bizim

Pop music

Art of Animal
Art of Animal

cat, dog, tiger, lion, zebra, horse, ant, parrot, fish, eagle, bird, crow, gorilla

carlos aymar
carlos aymar

male vocals samba,

Psychic Planet
Psychic Planet

dreamy, psychedelic rock, progressive rock, eerie

Don't Go Away
Don't Go Away

female voice, guitar, k-pop

设计师的世界
设计师的世界

Hip Hop, Rap, faMale Vocal, 95 BPM, Dm-Am-Gm-A7, Synth Bass & Drum Machine & Electric Piano

Whispering Willows
Whispering Willows

lyrical tranquil traditional chinese