import streamlit as st from run_eval import run_generate st.write("# GupShup") st.write("## Summarizing Open-Domain Code-Switched Conversations") task_type = st.sidebar.selectbox( "Task type", ["Hinglish to English", "English to English"] ) model_name = st.sidebar.selectbox( "Model", ["Pegasus", "mBart", "Bart", "GPT", "T5", "T5_MTL"] ) default_value = "summarize: Debanjan: Hi! kya tum EMNLP attend kar rahein ho? Anish: nehi I will skip this year. what about you? Debanjan: mein virtually attend kar raha hu Debanjan: hopefully can attend the conference in person from next year... Anish: haan dekhtey hain, in person attend karney mein alaag hi maaza hain Debanjan: but I also like this hybrid mode allows to attend the sessions in case you do not make it Anish: right Anish: if you are attending to mujhe interesting papers kuch bhej dena Debanjan: sure" conv_form = st.sidebar.form(key="conv_form") conv_ip = conv_form.text_input(label="Please enter the conversastion", value=default_value) conv_submit_button = conv_form.form_submit_button(label="Submit") # sent = st.text_area("Text", default_value, height=275) st.write("### Task Type:", task_type) st.write("### Model:", model_name) x = "fg" src_file = None tar_file = None gen_file = "generated_summary.txt" score_file = None if conv_submit_button: if conv_ip == "": st.write("Pls enter non empty conversastion") else: st.write("### Summarizing below Conversastion") st.write(conv_ip) src_file = "conversastion.txt" src_fp = open(src_file, "w") src_fp.write(conv_ip) src_fp.close() tt = "h2e" if task_type == "English to English": tt = "e2e" elif task_type == "Hinglish to English": tt = "h2e" model_name_path = "midas/gupshup_" + str(tt) + "_" + str(model_name).lower() result = run_generate( verbose=True, model_name_path=model_name_path, src_txt=src_file, tar_txt=tar_file, gen_path=gen_file, scor_path=score_file, batch_size=8, ) if conv_submit_button: st.write("summary:") fp = open(gen_file, "r") summary = fp.readlines() fp.close() st.write(summary)