Spaces:
Running
Running
updating async problem + dockerfile update
Browse files- Dockerfile +6 -0
- mediaunmasked/services/analyzer_service.py +2 -2
Dockerfile
CHANGED
@@ -4,6 +4,9 @@ FROM python:3.10-slim
|
|
4 |
# Set working directory inside container
|
5 |
WORKDIR /app
|
6 |
|
|
|
|
|
|
|
7 |
# Copy dependencies
|
8 |
COPY requirements.txt .
|
9 |
RUN pip install --no-cache-dir -r requirements.txt
|
@@ -14,6 +17,9 @@ COPY . .
|
|
14 |
# Set PYTHONPATH (simplified)
|
15 |
ENV PYTHONPATH=/app
|
16 |
|
|
|
|
|
|
|
17 |
# Expose FastAPI's default port
|
18 |
EXPOSE 7860
|
19 |
|
|
|
4 |
# Set working directory inside container
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Create a writable cache directory for Hugging Face
|
8 |
+
RUN mkdir -p /app/.cache/huggingface/hub && chmod -R 777 /app/.cache
|
9 |
+
|
10 |
# Copy dependencies
|
11 |
COPY requirements.txt .
|
12 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
17 |
# Set PYTHONPATH (simplified)
|
18 |
ENV PYTHONPATH=/app
|
19 |
|
20 |
+
# Set the Hugging Face transformers cache directory
|
21 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
22 |
+
|
23 |
# Expose FastAPI's default port
|
24 |
EXPOSE 7860
|
25 |
|
mediaunmasked/services/analyzer_service.py
CHANGED
@@ -24,8 +24,8 @@ class AnalyzerService:
|
|
24 |
try:
|
25 |
logger.info(f"Analyzing article: {request.url}")
|
26 |
|
27 |
-
# Scrape article
|
28 |
-
article =
|
29 |
if not article:
|
30 |
raise HTTPException(
|
31 |
status_code=400,
|
|
|
24 |
try:
|
25 |
logger.info(f"Analyzing article: {request.url}")
|
26 |
|
27 |
+
# Scrape article (now synchronous)
|
28 |
+
article = scraper.scrape_article(request.get_url_str())
|
29 |
if not article:
|
30 |
raise HTTPException(
|
31 |
status_code=400,
|