Commit
·
464c060
1
Parent(s):
bf1d408
Updating files
Browse files- .oauth.yaml +8 -0
- Dockerfile +39 -0
- README.md +7 -11
- entrypoint.sh +8 -0
.oauth.yaml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
enabled: true
|
2 |
+
providers:
|
3 |
+
- name: huggingface
|
4 |
+
client_id: ${OAUTH2_HUGGINGFACE_CLIENT_ID}
|
5 |
+
client_secret: ${OAUTH2_HUGGINGFACE_CLIENT_SECRET}
|
6 |
+
scope: openid profile
|
7 |
+
allowed_workspaces:
|
8 |
+
- name: admin
|
Dockerfile
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Set the working directory
|
2 |
+
WORKDIR /app
|
3 |
+
|
4 |
+
# Copy the current directory contents into the container
|
5 |
+
COPY . /app
|
6 |
+
|
7 |
+
# Define the user ID
|
8 |
+
ARG USER_ID=1000
|
9 |
+
ENV USER_ID=$USER_ID
|
10 |
+
|
11 |
+
# Create a new user if it doesn't exist
|
12 |
+
RUN if [ -z "$USER_ID" ]; then \
|
13 |
+
echo "User ID not provided. Using the default user ID 1000."; \
|
14 |
+
USER_ID=1000; \
|
15 |
+
fi && \
|
16 |
+
if id "$USER_ID" >/dev/null 2>&1; then \
|
17 |
+
echo "User with ID $USER_ID already exists."; \
|
18 |
+
else \
|
19 |
+
adduser --uid "$USER_ID" --disabled-password --gecos '' appuser; \
|
20 |
+
fi
|
21 |
+
|
22 |
+
# Set permissions
|
23 |
+
RUN chown -R appuser:appuser /app && chmod -R 755 /app
|
24 |
+
|
25 |
+
# Install necessary tools
|
26 |
+
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
27 |
+
|
28 |
+
# Set up the entrypoint script
|
29 |
+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
30 |
+
RUN chmod +x /usr/local/bin/entrypoint.sh
|
31 |
+
|
32 |
+
# Switch to the non-root user
|
33 |
+
USER appuser
|
34 |
+
|
35 |
+
# Define the entrypoint
|
36 |
+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
37 |
+
|
38 |
+
# Default command
|
39 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|
README.md
CHANGED
@@ -1,17 +1,13 @@
|
|
1 |
---
|
2 |
title: "Chat with PDF •\_OpenAI"
|
|
|
|
|
|
|
3 |
sdk: gradio
|
4 |
-
sdk_version:
|
5 |
-
|
6 |
app_file: app.py
|
7 |
-
|
8 |
-
hf_oauth_expiration_minutes: 480
|
9 |
-
hf_oauth_scopes:
|
10 |
-
- read-repos
|
11 |
-
- write-repos
|
12 |
-
- manage-repos
|
13 |
-
- inference-api
|
14 |
-
short_description: chatbot
|
15 |
---
|
16 |
|
17 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
title: "Chat with PDF •\_OpenAI"
|
3 |
+
emoji: 📄🤖
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: pink
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.39.0
|
8 |
+
|
9 |
app_file: app.py
|
10 |
+
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
---
|
12 |
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
entrypoint.sh
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
set -e
|
3 |
+
|
4 |
+
# Set permissions at runtime
|
5 |
+
chmod -R 777 /app
|
6 |
+
|
7 |
+
# Execute the main command
|
8 |
+
exec "$@"
|