Spaces:
Runtime error
Runtime error
File size: 465 Bytes
49bcb0f 8948a3a cc75053 ecd23f2 49bcb0f 3151848 49bcb0f 05a2536 49bcb0f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import requests
from . import app
API_URL = "https://api-inference.huggingface.co/models/google/gemma-1.1-7b-it"
def query(payload):
response = requests.post(API_URL, json=payload)
return response.json()
@app.get("/", tags=["Home"])
def api_home():
return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
@app.get("/api/generate", summary="Generate text from prompt", tags=["Generate"])
def inference(input: str):
return query({"inputs": input})
|