Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,17 +1,16 @@
|
|
| 1 |
import requests
|
| 2 |
|
| 3 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
-
|
| 5 |
from fastapi import FastAPI
|
|
|
|
| 6 |
|
| 7 |
API_URL = "https://api-inference.huggingface.co/models/google/gemma-1.1-7b-it"
|
| 8 |
|
|
|
|
|
|
|
| 9 |
def query(payload):
|
| 10 |
response = requests.post(API_URL, json=payload)
|
| 11 |
return response.json()
|
| 12 |
|
| 13 |
-
app = FastAPI()
|
| 14 |
-
|
| 15 |
app.add_middleware(
|
| 16 |
CORSMiddleware,
|
| 17 |
allow_origins=["*"],
|
|
@@ -19,7 +18,7 @@ app.add_middleware(
|
|
| 19 |
allow_methods=["*"],
|
| 20 |
allow_headers=["*"],
|
| 21 |
)
|
| 22 |
-
|
| 23 |
|
| 24 |
@app.get("/", tags=["Home"])
|
| 25 |
def api_home():
|
|
|
|
| 1 |
import requests
|
| 2 |
|
|
|
|
|
|
|
| 3 |
from fastapi import FastAPI
|
| 4 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
|
| 6 |
API_URL = "https://api-inference.huggingface.co/models/google/gemma-1.1-7b-it"
|
| 7 |
|
| 8 |
+
app = FastAPI()
|
| 9 |
+
|
| 10 |
def query(payload):
|
| 11 |
response = requests.post(API_URL, json=payload)
|
| 12 |
return response.json()
|
| 13 |
|
|
|
|
|
|
|
| 14 |
app.add_middleware(
|
| 15 |
CORSMiddleware,
|
| 16 |
allow_origins=["*"],
|
|
|
|
| 18 |
allow_methods=["*"],
|
| 19 |
allow_headers=["*"],
|
| 20 |
)
|
| 21 |
+
|
| 22 |
|
| 23 |
@app.get("/", tags=["Home"])
|
| 24 |
def api_home():
|