test / main.py
SolomonHsu's picture
Update main.py
cc75053 verified
raw
history blame contribute delete
465 Bytes
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})