|
import LLM_Helper |
|
import streamlit as st |
|
import UI_Helper |
|
from PIL import Image |
|
|
|
|
|
icon = Image.open('logo.png') |
|
|
|
|
|
st.set_page_config(page_title="Book Name Genrator", |
|
page_icon=icon, |
|
layout="wide" |
|
) |
|
|
|
company_logo_path = 'logo.png' |
|
st.image(company_logo_path, width=50) |
|
|
|
st.title("Book Name Generator") |
|
|
|
|
|
def main(): |
|
global submitted, prompt, selected_values2, response |
|
selected_value1 = UI_Helper.radio_button() |
|
if selected_value1 == '': |
|
submitted = st.button('Submit') |
|
elif selected_value1 == 'Education': |
|
input_text = UI_Helper.text_box() |
|
selected_value3 = UI_Helper.radio_button2() |
|
if input_text == '': |
|
response = LLM_Helper.Book_Name1(selected_value1) |
|
design = "#" * (len(response)*2) |
|
|
|
submitted = st.button('Submit') |
|
else: |
|
if selected_value3 == 'All': |
|
response = LLM_Helper.Book_Name2(selected_value1,input_text) |
|
design = "#" * (len(response)*2) |
|
|
|
submitted = st.button('Submit') |
|
else: |
|
entered_number = UI_Helper.number_input() |
|
response = LLM_Helper.Book_Name3(selected_value1,input_text,entered_number) |
|
design = "#" * (len(response)*2) |
|
|
|
submitted = st.button('Submit') |
|
elif selected_value1 == 'Non Education': |
|
selected_values2 = UI_Helper.dropdown_with_checkbox() |
|
selected_value3 = UI_Helper.radio_button2() |
|
if selected_value3 == 'All': |
|
response = LLM_Helper.Book_Name4(selected_value1,selected_values2) |
|
design = "#" * (len(response)*2) |
|
|
|
submitted = st.button('Submit') |
|
else: |
|
entered_number = UI_Helper.number_input() |
|
response = LLM_Helper.Book_Name5(selected_value1,selected_values2,entered_number) |
|
design = "#" * (len(response)*2) |
|
|
|
submitted = st.button('Submit') |
|
|
|
|
|
if submitted: |
|
if selected_value1 == '': |
|
st.error(f'Plese selet either Education or Non Education') |
|
elif selected_value1 == 'Education': |
|
st.write(design) |
|
st.write("## " + response + " ##") |
|
st.write(design) |
|
elif selected_value1 == 'Non Education' and len(selected_values2) >= 1: |
|
st.write(design) |
|
st.write("## " + response + " ##") |
|
st.write(design) |
|
elif len(selected_values2) == 0: |
|
st.error('Please enter some geners name from list.') |
|
else: |
|
st.error('Something went wrong please try again.') |
|
if __name__ == "__main__": |
|
main() |