title: why is my fastapi or uvicorn getting shutdown?
body: <p>I am trying to run a service that uses simple transformers Roberta model to do classification. the inferencing script/function itself is working as expected when tested. when i include that with fast api its shutting down the server.</p>
  <pre><code>uvicorn==0.11.8
  fastapi==0.61.1
  simpletransformers==0.51.6
  cmd : uvicorn --host 0.0.0.0 --port 5000 src.main:app
  </code></pre>
  <hr />
  <pre><code>@app.get(&quot;/article_classify&quot;)
  def classification(text:str):
      &quot;&quot;&quot;function to classify article using a deep learning model.
      Returns:
          [type]: [description]
      &quot;&quot;&quot;
  
      _,_,result = inference(text)
      return result
  </code></pre>
  <p>error :</p>
  <pre><code>INFO:     Started server process [8262]
  INFO:     Waiting for application startup.
  INFO:     Application startup complete.
  INFO:     Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
  INFO:     127.0.0.1:36454 - &quot;GET / HTTP/1.1&quot; 200 OK
  INFO:     127.0.0.1:36454 - &quot;GET /favicon.ico HTTP/1.1&quot; 404 Not Found
  INFO:     127.0.0.1:36454 - &quot;GET /docs HTTP/1.1&quot; 200 OK
  INFO:     127.0.0.1:36454 - &quot;GET /openapi.json HTTP/1.1&quot; 200 OK
  before
  100%|████████████████████████████████████████████████████████████████████████████| 1/1 [00:00&lt;00:00, 17.85it/s]
  INFO:     Shutting down
  INFO:     Finished server process [8262]
  </code></pre>
  <p>inferencing script :</p>
  <pre><code>model_name = &quot;checkpoint-3380-epoch-20&quot;
  model = MultiLabelClassificationModel(&quot;roberta&quot;,&quot;src/outputs/&quot;+model_name)
  def inference(input_text,model_name=&quot;checkpoint-3380-epoch-20&quot;):
      &quot;&quot;&quot;Function to run inverence on one sample text&quot;&quot;&quot;
      #model = MultiLabelClassificationModel(&quot;roberta&quot;,&quot;src/outputs/&quot;+model_name)
      all_tags =[]
      if isinstance(input_text,str):
          print(&quot;before&quot;)
          result ,output = model.predict([input_text])
          print(result)
          tags=[]
          for idx,each in enumerate(result[0]):
              if each==1:
                  tags.append(classes[idx])
          all_tags.append(tags)
      elif isinstance(input_text,list):
          result ,output = model.predict(input_text)
          tags=[]
          for res in result : 
              for idx,each in enumerate(res):
                  if each==1:
                      tags.append(classes[idx])
              all_tags.append(tags)
  
      return result,output,all_tags
  </code></pre>
  <p>update: tried with flask and the service is working but when adding uvicorn on top of flask its getting stuck in a loop of restart.</p>