File size: 403 Bytes
4ff0f4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastapi import FastAPI
from transformers import pipeline

# Use the text-generation pipeline
pipe = pipeline("text-generation", model="Hawoly18/Adia_Llama3.1")

app = FastAPI()

@app.get('/')
def home():
    return {"hello": "Concree"}

@app.get('/generate')
def generate(text: str):
    # Generate text using the pipeline
    result = pipe(text)
    return {"result": result[0]['generated_text']}