Spaces:
Sleeping
Sleeping
Commit ·
572435e
1
Parent(s): e924141
Updated
Browse files- main.py +8 -4
- requirements.txt +8 -10
main.py
CHANGED
|
@@ -1,12 +1,16 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Header
|
| 2 |
from pydantic import BaseModel
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
from langchain.chains import LLMChain
|
| 6 |
from langchain.prompts import PromptTemplate
|
| 7 |
from langchain.memory import ConversationBufferMemory
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
# ===============================================
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Header
|
| 2 |
from pydantic import BaseModel
|
| 3 |
+
import torch
|
| 4 |
+
import logging
|
| 5 |
+
|
| 6 |
+
# LangChain imports (stable with latest version >=1.0)
|
| 7 |
+
from langchain.llms import HuggingFacePipeline
|
| 8 |
from langchain.chains import LLMChain
|
| 9 |
from langchain.prompts import PromptTemplate
|
| 10 |
from langchain.memory import ConversationBufferMemory
|
| 11 |
+
|
| 12 |
+
# Transformers pipeline
|
| 13 |
+
from transformers import pipeline
|
| 14 |
|
| 15 |
|
| 16 |
# ===============================================
|
requirements.txt
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
-
fastapi
|
| 2 |
-
uvicorn[standard]
|
| 3 |
-
torch
|
| 4 |
-
transformers
|
| 5 |
-
accelerate
|
| 6 |
-
langchain
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
pydantic
|
| 10 |
-
langchain-core
|
|
|
|
| 1 |
+
fastapi>=0.101.0
|
| 2 |
+
uvicorn[standard]>=0.23.0
|
| 3 |
+
torch>=2.1.0
|
| 4 |
+
transformers>=4.40.0
|
| 5 |
+
accelerate>=0.25.0
|
| 6 |
+
langchain>=1.0.0
|
| 7 |
+
huggingface-hub>=1.30.0
|
| 8 |
+
pydantic>=1.10.10
|
|
|
|
|
|