mike dupont commited on
Commit
a692df9
1 Parent(s): d147e4b

docker compose

Browse files
Files changed (4) hide show
  1. Dockerfile +2 -1
  2. app.py +60 -39
  3. run_agent.sh +13 -0
  4. rundocker.sh +3 -0
Dockerfile CHANGED
@@ -1,6 +1,7 @@
1
 
2
  FROM h4ckermike/lang_agent:dev
3
- FROM h4ckermike/unimath-coq-trace-batch2:test1
 
4
 
5
  FROM python:3.8.9
6
 
 
1
 
2
  FROM h4ckermike/lang_agent:dev
3
+ #FROM h4ckermike/unimath-coq-trace-batch2:test1
4
+ FROM h4ckermike/meta-coq-utils-data-1:2024-02-12
5
 
6
  FROM python:3.8.9
7
 
app.py CHANGED
@@ -1,42 +1,63 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import numpy as np
4
-
5
- st.title('Uber pickups in NYC')
6
-
7
- DATE_COLUMN = 'date/time'
8
- DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
9
- 'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
10
-
11
- @st.cache_data
12
- def load_data(nrows):
13
- data = pd.read_csv(DATA_URL, nrows=nrows)
14
- lowercase = lambda x: str(x).lower()
15
- data.rename(lowercase, axis='columns', inplace=True)
16
- data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
17
- return data
18
-
19
- data_load_state = st.text('Loading data...')
20
- data = load_data(10000)
21
- data_load_state.text("Done! (using st.cache)")
22
-
23
- if st.checkbox('Show raw data'):
24
- st.subheader('Raw data')
25
- st.write(data)
26
-
27
- st.subheader('Number of pickups by hour')
28
- hist_values = np.histogram(data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0]
29
- st.bar_chart(hist_values)
30
-
31
- # Some number in the range 0-23
32
- hour_to_filter = st.slider('hour', 0, 23, 17)
33
- filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
34
-
35
- st.subheader('Map of all pickups at %s:00' % hour_to_filter)
36
- st.map(filtered_data)
37
-
38
- uploaded_file = st.file_uploader("Choose a file")
39
- if uploaded_file is not None:
40
- st.write(uploaded_file.name)
41
- bytes_data = uploaded_file.getvalue()
42
- st.write(len(bytes_data), "bytes")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  import numpy as np
4
+ import os
5
+ from glob import glob
6
+ import subprocess
7
+
8
+ st.title('Welcome to introspector lang_agent!!')
9
+
10
+
11
+ limit = st.number_input("limit",value=40)
12
+ url = st.text_input("url",value="http://localhost:11434")
13
+ prompt = st.text_input("prompt",value="Consider this text as a creative writing prompt: ")
14
+
15
+ source_data = st.selectbox(
16
+ 'What data source should we read',
17
+ ( '/mnt/data1/2024/02/12/meta-coq-common/',
18
+ '/data'))
19
+
20
+ st.write('You selected:', source_data)
21
+
22
+ #in python read directory source_data recursivly and print it in select box in streamlit
23
+
24
+
25
+
26
+ def get_files(path='.'):
27
+ """Recursive function to find all files in given directory path."""
28
+ files = []
29
+ for item in os.listdir(path):
30
+ fp = os.path.join(path, item)
31
+ if os.path.isdir(fp):
32
+ files.append(fp)
33
+ files += get_files(fp)
34
+ return files
35
+
36
+ files = get_files(source_data)
37
+ if len(files) > limit:
38
+ files = files[0:limit]
39
+ #st.write(files)
40
+
41
+ mode = st.selectbox("mode", [
42
+ "--ollama",
43
+ "--openai",
44
+
45
+ ])
46
+ model = st.selectbox("model", ["mistral","mixtral"])
47
+
48
+ input_dir = st.selectbox("Select a file", files)
49
+ st.write(f"You selected file: {input_dir}")
50
+
51
+ if st.button("Process data"):
52
+ prompt = prompt.replace("\"","\'")
53
+ cmd = ["bash",
54
+ "./run_agent.sh",
55
+ input_dir,
56
+ url,
57
+ mode,
58
+ model,
59
+ "\"{prompt}\""]
60
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
61
+
62
+ for line in proc.stdout:
63
+ st.write(line)
run_agent.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #while true;
2
+ #do
3
+ #cd /mnt/data1/2024/01/15/lang_agent/
4
+ cd /lang_agent/
5
+ dune exec bin/scanner.exe -- -c .txt -x .test \
6
+ -s $1 \
7
+ -p $5 \
8
+ "$3" \
9
+ -m $4 \
10
+ -u $2
11
+
12
+
13
+ #done;
rundocker.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ sudo docker kill streamlit
2
+ sudo docker rm streamlit
3
+ sudo docker run --name streamlit -v /home/mdupont/2024/02/12/streamlit-docker-lang-agent-introspector/:/home/user/app/ -p 8501:8501 streamlit