Giter Club home page Giter Club logo

Comments (2)

dotX12 avatar dotX12 commented on June 15, 2024 4

@auyeskhan-n , hello!
It's much easier than you thought :)
You don't need access to loop.

import uvicorn
from fastapi import Depends
from fastapi import FastAPI
from fastapi import File
from fastapi import UploadFile

from shazamio import Shazam

app = FastAPI()


def get_shazamio():
    shazam = Shazam()
    yield shazam


@app.post("/recognize")
async def recognize_file(
    shazam_service: Shazam = Depends(get_shazamio), file: UploadFile = File(...)
):
    out = await shazam_service.recognize_song(await file.read())
    return out


if __name__ == '__main__':
    uvicorn.run(app)

image

INFO:     Started server process [451608]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     127.0.0.1:59393 - "GET /docs HTTP/1.1" 200 OK
INFO:     127.0.0.1:59393 - "GET /openapi.json HTTP/1.1" 200 OK
INFO:     127.0.0.1:59394 - "POST /recognize HTTP/1.1" 200 OK

from shazamio.

auyeskhan-n avatar auyeskhan-n commented on June 15, 2024

Thanks! Works smooth :)

from shazamio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.