YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_jwt_extended import ( JWTManager, create_access_token, jwt_required, get_jwt_identity ) from datetime import datetime import uuid

------------------ APP CONFIG ------------------

app = Flask(name) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///marketplace.db" app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False app.config["JWT_SECRET_KEY"] = "super-secret-key"

db = SQLAlchemy(app) jwt = JWTManager(app)

------------------ MODELS ------------------

class User(db.Model): id = db.Column(db.String, primary_key=True) username = db.Column(db.String, unique=True) password = db.Column(db.String) created_at = db.Column(db.DateTime, default=datetime.utcnow)

class Listing(db.Model): id = db.Column(db.String, primary_key=True) title = db.Column(db.String) description = db.Column(db.String) price = db.Column(db.Float) category = db.Column(db.String) location = db.Column(db.String) seller_id = db.Column(db.String) created_at = db.Column(db.DateTime, default=datetime.utcnow) ai_score = db.Column(db.Float, default=0)

------------------ AI ENGINE ------------------

def ai_price_suggestion(title, price): if "iphone" in title.lower(): return price * 1.1 return price

def ai_moderation(text): banned = ["scam", "fake", "illegal"] return not any(word in text.lower() for word in banned)

def ai_rank(listing): score = 0 score += max(0, 100 - listing.price) if "new" in listing.description.lower(): score += 20 return score

------------------ AUTH ------------------

@app.route("/auth/register", methods=["POST"]) def register(): data = request.json user = User( id=str(uuid.uuid4()), username=data["username"], password=data["password"] ) db.session.add(user) db.session.commit() return jsonify(msg="registered")

@app.route("/auth/login", methods=["POST"]) def login(): data = request.json user = User.query.filter_by(username=data["username"], password=data["password"]).first() if not user: return jsonify(error="invalid credentials"), 401 token = create_access_token(identity=user.id) return jsonify(token=token)

------------------ LISTINGS ------------------

@app.route("/listings", methods=["POST"]) @jwt_required() def create_listing(): user_id = get_jwt_identity() data = request.json

if not ai_moderation(data["title"] + data["description"]):
    return jsonify(error="Listing rejected by AI moderation"), 400

suggested_price = ai_price_suggestion(data["title"], data["price"])

listing = Listing(
    id=str(uuid.uuid4()),
    title=data["title"],
    description=data["description"],
    price=suggested_price,
    category=data.get("category"),
    location=data.get("location"),
    seller_id=user_id
)

listing.ai_score = ai_rank(listing)

db.session.add(listing)
db.session.commit()

return jsonify(msg="listing created", price=suggested_price)

@app.route("/listings", methods=["GET"]) def feed(): listings = Listing.query.order_by(Listing.ai_score.desc()).all() return jsonify([ { "id": l.id, "title": l.title, "price": l.price, "location": l.location, "score": l.ai_score } for l in listings ])

@app.route("/listings/search") def search(): q = request.args.get("q", "") results = Listing.query.filter(Listing.title.contains(q)).all() return jsonify([ {"title": l.title, "price": l.price} for l in results ])

------------------ AI COMMAND INTERFACE ------------------

@app.route("/ai/command", methods=["POST"]) @jwt_required() def ai_command(): text = request.json.get("prompt").lower()

if "show stats" in text:
    return jsonify(
        users=User.query.count(),
        listings=Listing.query.count()
    )

return jsonify(msg="AI command processed")

------------------ SYSTEM ------------------

@app.route("/") def status(): return jsonify( app="AI Marketplace", status="running", listings=Listing.query.count() )

------------------ INIT ------------------

with app.app_context(): db.create_all()

if name == "main": app.run(debug=True)

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support