Spaces:
Sleeping
Sleeping
working streamlit app
Browse files- Dockerfile +7 -1
- fe/app.py +8 -6
Dockerfile
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
# Use an official Python base image
|
2 |
FROM python:3.10-slim
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
@@ -11,7 +17,7 @@ COPY requirements.txt .
|
|
11 |
RUN pip install --trusted-host pypi.python.org -r requirements.txt
|
12 |
|
13 |
# Copy the rest of the application code into the container
|
14 |
-
COPY run.sh api fe .
|
15 |
|
16 |
# Expose the port the app runs on
|
17 |
EXPOSE 8080
|
|
|
1 |
# Use an official Python base image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
+
# Set up a new user named "user" with user ID 1000
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Switch to the "user" user
|
8 |
+
USER user
|
9 |
+
|
10 |
# Set the working directory
|
11 |
WORKDIR /app
|
12 |
|
|
|
17 |
RUN pip install --trusted-host pypi.python.org -r requirements.txt
|
18 |
|
19 |
# Copy the rest of the application code into the container
|
20 |
+
COPY --chown=user run.sh api fe .
|
21 |
|
22 |
# Expose the port the app runs on
|
23 |
EXPOSE 8080
|
fe/app.py
CHANGED
@@ -8,13 +8,15 @@ BE = os.getenv("be_url")
|
|
8 |
|
9 |
datasets = requests.get(f"{BE}/v1/datasets", timeout=500).json()
|
10 |
|
11 |
-
st.sidebar.title("
|
12 |
-
ds = st.sidebar.selectbox(datasets
|
|
|
13 |
|
14 |
query = st.text_input("Enter your search query")
|
|
|
15 |
|
|
|
|
|
16 |
|
17 |
-
answer
|
18 |
-
|
19 |
-
|
20 |
-
st.text = answer
|
|
|
8 |
|
9 |
datasets = requests.get(f"{BE}/v1/datasets", timeout=500).json()
|
10 |
|
11 |
+
st.sidebar.title("Datasets")
|
12 |
+
ds = st.sidebar.selectbox(options=[ d["name"] for d in datasets],
|
13 |
+
label="Select your dataset")
|
14 |
|
15 |
query = st.text_input("Enter your search query")
|
16 |
+
print(query)
|
17 |
|
18 |
+
answer = requests.get(f"http://localhost:8080/v1/datasets/{ds}/answer?query={query}",
|
19 |
+
timeout=5000 )
|
20 |
|
21 |
+
print(answer.json()["answer"])
|
22 |
+
st.write(answer.json()["answer"])
|
|
|
|