Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,13 @@ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
|
| 11 |
#creating routes
|
| 12 |
@app.get("/")
|
| 13 |
def home():
|
| 14 |
-
return {"
|
| 15 |
|
| 16 |
#define a function to handle the GET request at '/generate'
|
| 17 |
@app.get("/generate")
|
| 18 |
def generate(text: str):
|
| 19 |
# use the pipeline to generate text from given input text
|
| 20 |
-
output = pipe(text, max_new_tokens=
|
| 21 |
print(output) # Debugging line
|
| 22 |
#return the correct key based on model output
|
| 23 |
return {"output": output[0]['generated_text']}
|
|
|
|
| 11 |
#creating routes
|
| 12 |
@app.get("/")
|
| 13 |
def home():
|
| 14 |
+
return {"message": "Your FastAPI and Model is Running"}
|
| 15 |
|
| 16 |
#define a function to handle the GET request at '/generate'
|
| 17 |
@app.get("/generate")
|
| 18 |
def generate(text: str):
|
| 19 |
# use the pipeline to generate text from given input text
|
| 20 |
+
output = pipe(text, max_new_tokens=150, temperature=0.3, top_k=30) # Adjust these parameters as per your output accuracy
|
| 21 |
print(output) # Debugging line
|
| 22 |
#return the correct key based on model output
|
| 23 |
return {"output": output[0]['generated_text']}
|