Spaces:
Sleeping
Sleeping
Commit
·
a8a0316
1
Parent(s):
46759d9
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,28 +1,20 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
-
from
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
app = FastAPI()
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
"""
|
| 20 |
-
Using the text2text-generation pipeline from `transformers`, generate text
|
| 21 |
-
from the given input text. The model used is `google/flan-t5-small`, which
|
| 22 |
-
can be found [here](<https://huggingface.co/google/flan-t5-small>).
|
| 23 |
-
"""
|
| 24 |
-
# Use the pipeline to generate text from the given input text
|
| 25 |
-
output = pipe(text)
|
| 26 |
-
|
| 27 |
-
# Return the generated text in a JSON response
|
| 28 |
-
return {"output": output[0]["generated_text"]}
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from model_config import console_chat
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# Get time
|
| 6 |
+
|
| 7 |
app = FastAPI()
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# FastAPI
|
| 12 |
+
@app.get("/")
|
| 13 |
+
def return_api(text: str):
|
| 14 |
+
# Get the caption
|
| 15 |
+
|
| 16 |
+
response= console_chat.chat(text)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# Return message
|
| 20 |
+
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|