|
import streamlit as st |
|
import subprocess |
|
import configparser |
|
|
|
|
|
config = configparser.ConfigParser() |
|
|
|
|
|
def user_input_page(): |
|
st.title("Research Topic and Websites Input") |
|
|
|
|
|
topic = st.text_input("Enter the research topic:") |
|
|
|
|
|
websites = st.text_area("Enter the list of websites (one per line):") |
|
websites = websites.splitlines() |
|
|
|
config['DEFAULT'] = {'DEFAULT_TOPIC': "\"{0}\"".format(topic), |
|
'INITIAL_WEBSITES': websites} |
|
|
|
with open('config.ini', 'w') as configfile: |
|
config.write(configfile) |
|
|
|
|
|
if st.button("Execute Web Research"): |
|
|
|
process = subprocess.run(["python3", "web_search.py"], stderr=subprocess.PIPE, text=True) |
|
error_message = process.stderr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if process.returncode != 0: |
|
st.error(f"Error occurred: {error_message}") |
|
|
|
st.success("Web search executed successfully!") |
|
|
|
|
|
user_input_page() |
|
|