Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

75
Views
Cómo usar la entrada a través de la solicitud de obtención como una variable en fastapi

Estoy usando una API rápida para hacer predicciones. Estoy tomando el si y las entradas a través de la solicitud de obtención y devolviendo la respuesta. Pero quiero cambiar el punto final dinámicamente desde la identificación de entrada proporcionada por el usuario y no pude hacerlo. Obtengo el name task_id is not defined

 from pydantic import BaseModel class SoluteSolvent(BaseModel): solvent: str solute: str task_id: int api_names = ['/predict','/predict_json'] @app.get(api_names[task_id]) def predict(task_id: int,solute: str, solvent: str): if task_id == 0: results = predictions(solute, solvent) response["interaction_map"] = (results[1].detach().numpy()).tolist() response["predictions"] = results[0].item() return {'result': response} elif task_id == 1: return "this is second one"
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!