File size: 869 Bytes
0a026c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from evaluator import evaluator

st.title('Natural Language Explanation Demo')


model_name = st.selectbox('Select a model:', ['gpt4-1106', 'gpt35-1106'])

question = st.text_input('Enter question:', '')
explaination = st.text_input('Enter explanation:', '')

if st.button('Evaluate Explanation'):
    # print the question and explanation
    st.write('### Question')
    st.write(question)
    st.write('### Explanation')
    st.write(explaination)

    # Evaluate the question and expl
    if question and explaination:
        eval = evaluator(model_name)
        scores = eval(question,explaination)  # You need to handle the model logic
        st.write('### Scores')
        for principle, score in scores.items():
            st.write(f"{principle}: {score}")
    else:
        st.write('Please enter question and explanation to evaluate')