nakas's picture
Update Main.py
754b3f1
raw
history blame
1.23 kB
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")