Spaces:
Running
Running
Commit
·
a80a32b
1
Parent(s):
a6b0504
fix docker permission; limit demo length
Browse files- Dockerfile +5 -5
- app.py +5 -0
Dockerfile
CHANGED
@@ -10,11 +10,11 @@ COPY ./app.py /app/app.py
|
|
10 |
|
11 |
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
|
20 |
CMD ["funix", "app.py", "--host", "0.0.0.0", "--port", "7860", "--no-browser"]
|
|
|
10 |
|
11 |
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
12 |
|
13 |
+
RUN useradd -m -u 1000 user
|
14 |
+
ENV HOME=/home/user \
|
15 |
+
PATH=/home/user/.local/bin:$PATH
|
16 |
|
17 |
+
RUN mkdir -p /app/.cache
|
18 |
+
RUN chown -R user /app
|
19 |
|
20 |
CMD ["funix", "app.py", "--host", "0.0.0.0", "--port", "7860", "--no-browser"]
|
app.py
CHANGED
@@ -23,6 +23,11 @@ def HHEM(
|
|
23 |
LLM_Response (str): a.k.a. the "hypothesis".
|
24 |
|
25 |
"""
|
|
|
|
|
|
|
|
|
|
|
26 |
pairs = [(LLM_Prompt, LLM_Response)]
|
27 |
|
28 |
score = hhem.predict(pairs)[0]
|
|
|
23 |
LLM_Response (str): a.k.a. the "hypothesis".
|
24 |
|
25 |
"""
|
26 |
+
|
27 |
+
if len(LLM_Prompt) + len(LLM_Response) > 500:
|
28 |
+
return Markdown("""Your input is too long for this demo. Please shorten them such that their total length is under 500 characters.""")
|
29 |
+
|
30 |
+
|
31 |
pairs = [(LLM_Prompt, LLM_Response)]
|
32 |
|
33 |
score = hhem.predict(pairs)[0]
|