Spaces:
Sleeping
Sleeping
Commit ·
af74796
1
Parent(s): 7850c5c
commit initial update 01092025-0001
Browse files- app.py +0 -7
- requirements.txt +0 -6
app.py
CHANGED
|
@@ -9,7 +9,6 @@ from fastapi.templating import Jinja2Templates
|
|
| 9 |
from pydantic import BaseModel
|
| 10 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 11 |
from huggingface_hub import login
|
| 12 |
-
from langchain_community.tools import DuckDuckGoSearchRun
|
| 13 |
from fastapi.middleware.cors import CORSMiddleware
|
| 14 |
import uvicorn
|
| 15 |
|
|
@@ -60,12 +59,6 @@ pipe = pipeline(
|
|
| 60 |
max_new_tokens=512
|
| 61 |
)
|
| 62 |
|
| 63 |
-
REAL_TIME_KEYWORDS = {"latest", "current", "news", "today", "price", "time", "live", "trending", "update", "happening"}
|
| 64 |
-
search_tool = DuckDuckGoSearchRun()
|
| 65 |
-
|
| 66 |
-
def should_search(message):
|
| 67 |
-
return any(kw in message.lower() for kw in REAL_TIME_KEYWORDS)
|
| 68 |
-
|
| 69 |
def is_incomplete(text):
|
| 70 |
return not re.search(r'[\.\!\?\'\"\u3002]\s*$', text.strip())
|
| 71 |
|
|
|
|
| 9 |
from pydantic import BaseModel
|
| 10 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 11 |
from huggingface_hub import login
|
|
|
|
| 12 |
from fastapi.middleware.cors import CORSMiddleware
|
| 13 |
import uvicorn
|
| 14 |
|
|
|
|
| 59 |
max_new_tokens=512
|
| 60 |
)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
def is_incomplete(text):
|
| 63 |
return not re.search(r'[\.\!\?\'\"\u3002]\s*$', text.strip())
|
| 64 |
|
requirements.txt
CHANGED
|
@@ -9,11 +9,5 @@ diffusers
|
|
| 9 |
accelerate
|
| 10 |
safetensors
|
| 11 |
huggingface_hub
|
| 12 |
-
sentencepiece
|
| 13 |
-
# NLP / Search
|
| 14 |
-
nltk
|
| 15 |
-
langchain_community
|
| 16 |
-
duckduckgo-search
|
| 17 |
-
pdfplumber
|
| 18 |
fastapi
|
| 19 |
uvicorn
|
|
|
|
| 9 |
accelerate
|
| 10 |
safetensors
|
| 11 |
huggingface_hub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
fastapi
|
| 13 |
uvicorn
|