Abhaykoul commited on
Commit
47e5b50
1 Parent(s): 4ec8b2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -32
app.py CHANGED
@@ -25,42 +25,33 @@ def web_search(query):
25
  response = requests.post(url, json=payload)
26
 
27
  if response.status_code == 200:
28
- results = response.json()
29
- if isinstance(results, list):
30
- return results
31
- else:
32
- return results.get('results') # Assuming 'results' contain relevant info
33
  else:
34
  return {"error": f"Error: {response.status_code}"}
35
 
36
  # Main function
37
  def main():
38
- st.title("AI Research Assistant")
39
- st.write("This tool helps you generate a research report based on the text obtained from a web search.")
40
-
41
- query = st.text_area("Enter your search query:", value="", height=200, max_chars=None, key=None)
42
-
43
- if st.button("Generate Report"):
44
- if query:
45
- # Perform web search
46
- search_results = web_search(query)
47
-
48
- # Extract relevant information and convert it into a message
49
- message = "" # Create an empty string to store the message
50
- for result in search_results:
51
- # Assuming each result is a string, you might adjust this part accordingly
52
- message += result + ". " # Concatenate results with a period
53
-
54
- # Combine prompt and message for AI conversation
55
- full_message = f"Generate a research report based on the following text: {message}"
56
-
57
- # Pass the combined message to the AI for generating a report
58
- report = chat_with_ai(full_message)
59
-
60
- # Display the report
61
- st.write(report)
62
- else:
63
- st.write("Please enter a search query.")
64
 
65
  if __name__ == "__main__":
66
- main()
 
25
  response = requests.post(url, json=payload)
26
 
27
  if response.status_code == 200:
28
+ return response.json().get('results') # Assuming 'results' contain relevant info
 
 
 
 
29
  else:
30
  return {"error": f"Error: {response.status_code}"}
31
 
32
  # Main function
33
  def main():
34
+ query = st.text_area("Enter resume content:")
35
+ if query:
36
+ prompt = f"Please provide a comprehensive review of the following resume and suggest improvements. The goal is to enhance its effectiveness in conveying the candidate's skills and experiences. Here's the resume content: {query}"
37
+
38
+ # Perform web search
39
+ search_results = web_search(query)
40
+
41
+ # Extract relevant information and convert it into a message
42
+ message = "" # Create an empty string to store the message
43
+ for result in search_results:
44
+ # Assuming each result is a string, you might adjust this part accordingly
45
+ message += result + ". " # Concatenate results with a period
46
+
47
+ # Combine prompt and message for AI conversation
48
+ full_message = prompt + " " + message
49
+
50
+ # Pass the combined message to the AI for generating a report
51
+ report = chat_with_ai(full_message)
52
+
53
+ # Display the report
54
+ st.write(report)
 
 
 
 
 
55
 
56
  if __name__ == "__main__":
57
+ main()