File size: 1,296 Bytes
7ad19af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
import streamlit as st
from new import chat_with_chatseo
import pandas as pd

st.set_page_config(layout="wide")

i, j = st.columns(2)
#set title
with i:
    st.title("Chat with ChatSEO")


    #create 3 input boxes for the 3 input variables
    issue = st.text_input("Issue")
    description = st.text_input("Description")
    url = st.text_input("URL")

    #create button and on press, run the chain
    if st.button("Run"):
        #run the chain
        output = chat_with_chatseo(issue, description, url).content
        #display the output
        st.write(output)

with j:

    st.write("## Upload a csv file")

    # Upload a csv file using streamlit and show the data
    uploaded_file = st.file_uploader("Choose a CSV file")
    if uploaded_file is not None:
        df = pd.read_csv(uploaded_file)
        result_df = df[df["Issue Priority"] == "High"].drop(["URLs", "% of Total", "How To Fix"], axis=1)
        st.write(result_df)
        for index, row in result_df.iterrows():
            with st.expander(row["Issue Name"]):
                st.write(row["Description"])
                if st.button("Fix Issue", key=index):
                    output = chat_with_chatseo(row["Issue Name"], row["Description"], "https://www.upthrust.io").content
                    st.write(output)