Update app.py
Browse files123451 unmodified line7891011121314from fastapi import FastAPIfrom transformers import pipeline# Create a new FastAPI app instanceapp = FastAPI()1 unmodified line# Initialize the text generation pipeline# This function will be able to generate text# given an input.pipe = pipeline("text2text-generation",model="google/flan-t5-small")# Define a function to handle the GET request at `/generate`# The generate() function is defined as a FastAPI route that takes a12345671 unmodified line91011121314151617181920from fastapi import FastAPIimport transformersimport torch#from transformers import pipeline# Create a new FastAPI app instanceapp = FastAPI()1 unmodified line# Initialize the text generation pipeline# This function will be able to generate text# given an input.#pipe = pipeline("text2text-generation",#model="google/flan-t5-small")pipe = transformers.pipeline("text-generation", model="meta-llama/Meta-Llama-3-8B", model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto")# Define a function to handle the GET request at `/generate`# The generate() function is defined as a FastAPI route that takes a
app.py+9-3