File size: 835 Bytes
6e08978
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import requests
import torch

#from typing import Optional

from fastapi import FastAPI, Header, HTTPException, BackgroundTasks
from fastapi.responses import FileResponse
#from huggingface_hub.hf_api import HfApi

#from .models import config, WebhookPayload

#WEBHOOK_SECRET = os.getenv("WEBHOOK_SECRET")
#HF_ACCESS_TOKEN = os.getenv("HF_ACCESS_TOKEN")
#AUTOTRAIN_API_URL = "https://api.autotrain.huggingface.co"
#AUTOTRAIN_UI_URL = "https://ui.autotrain.huggingface.co"


app = FastAPI()

@app.get("/")
async def home():

    gpu = 'GPU not available'
    if torch.cuda.is_available():
        gpu = 'GPU is available'
        print("GPU is available")
    else:
        print("GPU is not available")

    print('hello world')
    print(os.getenv("foo"))
    return {'success': True, 'response': 'hello world 3', 'gpu': gpu}