janar commited on
Commit
5c73d5c
1 Parent(s): ec7ef1b

fix loading

Browse files
Files changed (2) hide show
  1. fe/app.py +10 -7
  2. run.sh +2 -2
fe/app.py CHANGED
@@ -11,12 +11,15 @@ datasets = requests.get(f"{BE}/v1/datasets", timeout=500).json()
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"])
 
 
 
11
  st.sidebar.title("Datasets")
12
  ds = st.sidebar.selectbox(options=[ d["name"] for d in datasets],
13
  label="Select your dataset")
14
+ print(ds)
15
+ if ds:
16
+ query = st.text_input("Enter your search query",
17
+ placeholder="Ask your question")
18
+ if query:
19
+ answer = requests.get(f"http://localhost:8080/v1/datasets/{ds}/answer?query={query}",
20
  timeout=5000 )
21
 
22
+ print(answer.json()["answer"])
23
+ st.write(answer.json()["answer"])
24
+ else:
25
+ st.write("Choose your dataset!")
run.sh CHANGED
@@ -1,6 +1,6 @@
1
  #!/bin/sh
2
- uvicorn "main:app" "--host" "0.0.0.0" "--port" "8080" &
3
- streamlit run app.py
4
 
5
 
6
 
 
1
  #!/bin/sh
2
+ python -m uvicorn "main:app" "--host" "0.0.0.0" "--port" "8080" &
3
+ python -m streamlit run app.py
4
 
5
 
6