mike dupont
commited on
Commit
·
a692df9
1
Parent(s):
d147e4b
docker compose
Browse files- Dockerfile +2 -1
- app.py +60 -39
- run_agent.sh +13 -0
- 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 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
data
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|