File size: 489 Bytes
6590dbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from fastapi import FastAPI
import os
app = FastAPI()
@app.get("/")
def greet_json():
return {"Hello": "World!"}
@app.get("/hello")
def hello():
llm = HuggingFaceEndpoint(
repo_id="meta-llama/Meta-Llama-3-8B-Instruct",
task="text-generation",
max_new_tokens=100,
do_sample=False,
huggingfacehub_api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
)
result = llm.invoke("Hugging Face is")
print('result: ', result)
return (result) |