File size: 1,231 Bytes
5bdee70
 
 
 
 
 
 
 
 
754b3f1
5bdee70
 
 
 
 
 
 
 
 
948dc1f
5bdee70
 
 
948dc1f
5bdee70
948dc1f
5bdee70
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
from model import GeneralModel


def app():

    # Creating an object of prediction service
    pred = GeneralModel()

    api_key = st.sidebar.text_input("APIkey (current project not working)", type="password")
    # Using the streamlit cache
    @st.cache
    def process_prompt(input):

        return pred.model_prediction(input=input.strip() , api_key=api_key)

    if api_key:

        # Setting up the Title
        st.title("Stockfish fen to GPT-3 strong move explination coach (currently not working)")

        # st.write("---")

        s_example = "I will input chess fen strings and you reply back with the top three moves I should do next and why I should do each move. you also should evaluate my opponents play r2qnrk1/1p1bbppp/p1np4/2p2p2/P1B1P3/2NP1NQ1/1PP3PP/R1B2RK1 w - - 0 12"
        input = st.text_area(
            "Use the example below or write your own text",
            value=s_example,
            max_chars=1250,
            height=50,
        )

        if st.button("Submit"):
            with st.spinner(text="In progress"):
                report_text = process_prompt(input)
                st.markdown(report_text)
    else:
        st.error("🔑 Please enter API Key")