Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from transformers import pipeline
|
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
# Initialize the text generation pipeline
|
| 8 |
-
pipe = pipeline("text2text-generation", model="HridaAI/Hrida-T2SQL-3B-128k-V0.1"
|
| 9 |
|
| 10 |
@app.get("/")
|
| 11 |
def home():
|
|
@@ -14,7 +14,8 @@ def home():
|
|
| 14 |
# Define a function to handle the GET request at '/generate'
|
| 15 |
@app.get("/generate")
|
| 16 |
def generate(text: str):
|
|
|
|
| 17 |
# Use the pipeline to generate text from the given input text
|
| 18 |
-
|
| 19 |
# Return the generated text in JSON response
|
| 20 |
return {"output": output[0]['generated_text']}
|
|
|
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
# Initialize the text generation pipeline
|
| 8 |
+
pipe = pipeline("text2text-generation", model="HridaAI/Hrida-T2SQL-3B-128k-V0.1")
|
| 9 |
|
| 10 |
@app.get("/")
|
| 11 |
def home():
|
|
|
|
| 14 |
# Define a function to handle the GET request at '/generate'
|
| 15 |
@app.get("/generate")
|
| 16 |
def generate(text: str):
|
| 17 |
+
output = pipe(text, max_new_tokens=50)
|
| 18 |
# Use the pipeline to generate text from the given input text
|
| 19 |
+
|
| 20 |
# Return the generated text in JSON response
|
| 21 |
return {"output": output[0]['generated_text']}
|