File size: 1,083 Bytes
31b5de7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# this app is streamlit app for the current project hosted on huggingface spaces

import streamlit as st
from app.openai_chat_completion import OpenAIChatCompletions

st.title("Kaleidoscope Data - Data Cleaning LLM App")

st.write("This app is a demo of the LLM model for data cleaning. It is a work in progress and is not yet ready for production use.")

# text box or csv upload
text_input = st.text_input("Enter text", "Enter text here")
# csv_file = st.file_uploader("Upload CSV", type=['csv'])

# button to run data cleaning API on text via c class in openai_chat_completion.py
if st.button("Run Data Cleaning API"):
    
    # if text_input is not empty, run data cleaning API on text_input
    
    model = "gpt-4" # "gpt-3.5-turbo"
    sys_mes = "prompts/gpt4-system-message.txt"
    
    # instantiate OpenAIChatCompletions class
    # get response from openai_chat_completion method
    chat = OpenAIChatCompletions(model=model, system_message=sys_mes)
    response = chat.openai_chat_completion(text_input, n_shot=5)
    
    # display response
    st.write(response)