Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -2,7 +2,7 @@ from fastapi import FastAPI, HTTPException
|
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
from pydantic import BaseModel
|
4 |
from huggingface_hub import InferenceClient
|
5 |
-
import
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
@@ -55,7 +55,7 @@ def generate(item: Item):
|
|
55 |
@app.post("/generate/")
|
56 |
async def generate_text(item: Item):
|
57 |
# reject if key not the same
|
58 |
-
apiKey =
|
59 |
# if apiKey != key:
|
60 |
# return jsonify({
|
61 |
# "image_url": image_url,
|
|
|
2 |
from fastapi.middleware.cors import CORSMiddleware
|
3 |
from pydantic import BaseModel
|
4 |
from huggingface_hub import InferenceClient
|
5 |
+
import os
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
|
|
55 |
@app.post("/generate/")
|
56 |
async def generate_text(item: Item):
|
57 |
# reject if key not the same
|
58 |
+
apiKey = os.environ.get("API_KEY")
|
59 |
# if apiKey != key:
|
60 |
# return jsonify({
|
61 |
# "image_url": image_url,
|