Abhaykoul commited on
Commit
37ae59d
β€’
1 Parent(s): f0a5463

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -28
app.py CHANGED
@@ -2,8 +2,6 @@ import os
2
  import streamlit as st
3
  import requests
4
 
5
- #hello world
6
-
7
  # Create a session for reusing connections
8
  session = requests.Session()
9
 
@@ -22,9 +20,9 @@ def chat_with_ai(message, user_input):
22
  st.error(f"Error: {e}")
23
 
24
  # Function to perform web search
25
- def web_search(query):
26
  url = os.getenv("SEARCH_API_URL") # Webscout API
27
- payload = {"query": query}
28
  response = requests.post(url, json=payload)
29
 
30
  if response.status_code == 200:
@@ -34,31 +32,13 @@ def web_search(query):
34
 
35
  # Main function
36
  def main():
37
- st.set_page_config(page_title='HelpingAI Research Assistant', page_icon=":mag:")
38
- st.title("πŸ” HelpingAI Research Assistant")
39
  st.sidebar.header("πŸ› οΈ Settings")
40
  query = st.sidebar.text_input("πŸ”Ž Enter your research query: ")
41
  generate_report = st.sidebar.button("πŸ“ Generate Report")
42
 
43
- st.sidebar.markdown("---")
44
- st.sidebar.header("πŸ“š Recent Reports")
45
- recent_reports = st.sidebar.empty() # Placeholder for recent reports
46
-
47
- st.sidebar.markdown("---")
48
- st.sidebar.header("ℹ️ About this App")
49
- st.sidebar.info("This app uses chat and web search APIs by HelpingAI. The founder of HelpingAI is Abhay Koul. The web search API used in this app is publicly available and its name is Webscout API. For any inquiries or assistance, please contact the developer: Telegram: @OEvortex, Email: helpingai5@gmail.com.")
50
-
51
- st.sidebar.markdown("---")
52
- st.sidebar.header("🌐 How to Get Webscout API")
53
- st.sidebar.info("""
54
- 1. Sign up for a RapidAPI account if you haven't already.
55
- 2. Subscribe to the "webscout-api" on the RapidAPI marketplace to acquire your API key.
56
- 3. Choose the pricing tier that best fits your usage needs and budget.
57
- 4. Integrate the API into your applications using the provided endpoints.
58
- """)
59
-
60
- st.sidebar.markdown("---")
61
- st.sidebar.markdown("Β© 2024 HelpingAI. All rights reserved.")
62
 
63
  if generate_report:
64
  if query:
@@ -75,10 +55,8 @@ def main():
75
  if isinstance(report, dict) and 'error' in report:
76
  st.error(report['error'])
77
  else:
78
- st.write(report)
79
 
80
- # Update recent reports
81
- recent_reports.text(query)
82
  else:
83
  st.sidebar.error("❗ Please enter a research query.")
84
 
 
2
  import streamlit as st
3
  import requests
4
 
 
 
5
  # Create a session for reusing connections
6
  session = requests.Session()
7
 
 
20
  st.error(f"Error: {e}")
21
 
22
  # Function to perform web search
23
+ def web_search(keywords):
24
  url = os.getenv("SEARCH_API_URL") # Webscout API
25
+ payload = {"keywords": keywords} # Change query to keywords
26
  response = requests.post(url, json=payload)
27
 
28
  if response.status_code == 200:
 
32
 
33
  # Main function
34
  def main():
35
+ st.set_page_config(page_title='TechScout Research Assistant', page_icon=":mag:")
36
+ st.title("πŸ” TechScout Research Assistant")
37
  st.sidebar.header("πŸ› οΈ Settings")
38
  query = st.sidebar.text_input("πŸ”Ž Enter your research query: ")
39
  generate_report = st.sidebar.button("πŸ“ Generate Report")
40
 
41
+ output = st.empty()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  if generate_report:
44
  if query:
 
55
  if isinstance(report, dict) and 'error' in report:
56
  st.error(report['error'])
57
  else:
58
+ output.text_area("Generated Report", report, height=200, max_chars=None, key=None)
59
 
 
 
60
  else:
61
  st.sidebar.error("❗ Please enter a research query.")
62