Spaces:
Sleeping
Sleeping
updated code
Browse files- Dockerfile +15 -4
- aisearch_v1.py +2 -1
Dockerfile
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
|
|
| 1 |
FROM python:3.10
|
|
|
|
|
|
|
| 2 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
USER user
|
| 4 |
ENV HOME=/home/user \
|
| 5 |
PATH=/home/user/.local/bin:$PATH
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
COPY --chown=user . $HOME/app
|
| 8 |
-
|
| 9 |
-
RUN pip install -r requirements.txt
|
| 10 |
-
COPY . .
|
| 11 |
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use your existing base
|
| 2 |
FROM python:3.10
|
| 3 |
+
|
| 4 |
+
# Create a non‑root user
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
+
|
| 7 |
+
# Set up working dir under root, pre-create .chainlit and translations
|
| 8 |
+
WORKDIR /home/user/app
|
| 9 |
+
RUN mkdir -p /home/user/app/.chainlit/translations \
|
| 10 |
+
&& chown -R user:user /home/user/app/.chainlit
|
| 11 |
+
|
| 12 |
+
# Now switch to the non‑root user
|
| 13 |
USER user
|
| 14 |
ENV HOME=/home/user \
|
| 15 |
PATH=/home/user/.local/bin:$PATH
|
| 16 |
+
|
| 17 |
+
# Continue with copying code and installing
|
| 18 |
+
COPY --chown=user requirements.txt $HOME/app/requirements.txt
|
| 19 |
+
RUN pip install --no-cache-dir -r $HOME/app/requirements.txt
|
| 20 |
COPY --chown=user . $HOME/app
|
| 21 |
+
|
|
|
|
|
|
|
| 22 |
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
aisearch_v1.py
CHANGED
|
@@ -39,6 +39,7 @@ class ReportResponse(BaseModel):
|
|
| 39 |
title : str
|
| 40 |
justification : str
|
| 41 |
summary : str
|
|
|
|
| 42 |
|
| 43 |
# class ListReport(BaseModel)
|
| 44 |
|
|
@@ -172,7 +173,7 @@ class aiSearch:
|
|
| 172 |
async def gemini(self,prompt):
|
| 173 |
# try:
|
| 174 |
response = await gemini_client.aio.models.generate_content_stream(
|
| 175 |
-
model='gemini-
|
| 176 |
contents = self.sp_final_report,
|
| 177 |
config=types.GenerateContentConfig(
|
| 178 |
system_instruction=prompt,
|
|
|
|
| 39 |
title : str
|
| 40 |
justification : str
|
| 41 |
summary : str
|
| 42 |
+
link : str
|
| 43 |
|
| 44 |
# class ListReport(BaseModel)
|
| 45 |
|
|
|
|
| 173 |
async def gemini(self,prompt):
|
| 174 |
# try:
|
| 175 |
response = await gemini_client.aio.models.generate_content_stream(
|
| 176 |
+
model='gemini-1.5-flash',
|
| 177 |
contents = self.sp_final_report,
|
| 178 |
config=types.GenerateContentConfig(
|
| 179 |
system_instruction=prompt,
|