Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import requests
|
| 2 |
|
| 3 |
from fastapi import FastAPI
|
| 4 |
-
|
| 5 |
|
| 6 |
API_URL = "https://api-inference.huggingface.co/models/google/gemma-1.1-7b-it"
|
| 7 |
|
|
@@ -11,15 +11,6 @@ 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=["*"],
|
| 17 |
-
allow_credentials=True,
|
| 18 |
-
allow_methods=["*"],
|
| 19 |
-
allow_headers=["*"],
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
|
| 23 |
@app.get("/", tags=["Home"])
|
| 24 |
def api_home():
|
| 25 |
return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
|
|
|
|
| 1 |
import requests
|
| 2 |
|
| 3 |
from fastapi import FastAPI
|
| 4 |
+
|
| 5 |
|
| 6 |
API_URL = "https://api-inference.huggingface.co/models/google/gemma-1.1-7b-it"
|
| 7 |
|
|
|
|
| 11 |
response = requests.post(API_URL, json=payload)
|
| 12 |
return response.json()
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
@app.get("/", tags=["Home"])
|
| 15 |
def api_home():
|
| 16 |
return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
|