nakas commited on
Commit
117fa11
Β·
1 Parent(s): dd9d76c

Update Main.py

Browse files
Files changed (1) hide show
  1. Main.py +21 -17
Main.py CHANGED
@@ -5,23 +5,7 @@ import chess
5
  import chess.engine
6
  import stat
7
 
8
- def eval(fenstring):
9
- output = ""
10
- os.chmod("./stockfish_14_x64_popcnt",0o0777)
11
- engine = chess.engine.SimpleEngine.popen_uci("./stockfish_14_x64_popcnt")
12
 
13
-
14
- # Score: PovScore(Cp(+20), WHITE)
15
-
16
- board = chess.Board(fenstring)
17
-
18
- info = engine.analyse(board, chess.engine.Limit(depth=20),multipv=3)
19
-
20
-
21
- # Score: PovScore(Mate(+1), WHITE)
22
-
23
- engine.quit()
24
- return info
25
 
26
  def app():
27
 
@@ -31,6 +15,26 @@ def app():
31
  api_key = st.sidebar.text_input("APIkey (current project not working)", type="password")
32
  # Using the streamlit cache
33
  @st.cache
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  def process_prompt(input):
35
 
36
  return pred.model_prediction(input=input.strip() , api_key=api_key)
@@ -52,7 +56,7 @@ def app():
52
 
53
  if st.button("Submit"):
54
  with st.spinner(text="In progress"):
55
- report_text = process_prompt(input)
56
  st.markdown(report_text)
57
  else:
58
  st.error("πŸ”‘ Please enter API Key")
 
5
  import chess.engine
6
  import stat
7
 
 
 
 
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  def app():
11
 
 
15
  api_key = st.sidebar.text_input("APIkey (current project not working)", type="password")
16
  # Using the streamlit cache
17
  @st.cache
18
+ def eval(fenstring):
19
+ output = ""
20
+ os.chmod("./stockfish_14_x64_popcnt",0o0777)
21
+ engine = chess.engine.SimpleEngine.popen_uci("./stockfish_14_x64_popcnt")
22
+
23
+
24
+ # Score: PovScore(Cp(+20), WHITE)
25
+
26
+ board = chess.Board(fenstring)
27
+
28
+ info = engine.analyse(board, chess.engine.Limit(depth=20),multipv=3)
29
+
30
+
31
+
32
+ # Score: PovScore(Mate(+1), WHITE)
33
+
34
+ engine.quit()
35
+ #parse info eventually but lets just do it all as a test
36
+
37
+ return pred.model_prediction(input=info.strip() , api_key=api_key)
38
  def process_prompt(input):
39
 
40
  return pred.model_prediction(input=input.strip() , api_key=api_key)
 
56
 
57
  if st.button("Submit"):
58
  with st.spinner(text="In progress"):
59
+ report_text = eval(input)
60
  st.markdown(report_text)
61
  else:
62
  st.error("πŸ”‘ Please enter API Key")