Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import requests
|
|
|
3 |
|
4 |
# Create a session for reusing connections
|
5 |
session = requests.Session()
|
@@ -25,33 +26,20 @@ def web_search(query):
|
|
25 |
response = requests.post(url, json=payload)
|
26 |
|
27 |
if response.status_code == 200:
|
28 |
-
return response.json()
|
29 |
else:
|
30 |
return {"error": f"Error: {response.status_code}"}
|
31 |
|
32 |
# Main function
|
33 |
def main():
|
34 |
-
query = st.
|
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 |
-
|
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()
|
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
+
import time
|
4 |
|
5 |
# Create a session for reusing connections
|
6 |
session = requests.Session()
|
|
|
26 |
response = requests.post(url, json=payload)
|
27 |
|
28 |
if response.status_code == 200:
|
29 |
+
return response.json()
|
30 |
else:
|
31 |
return {"error": f"Error: {response.status_code}"}
|
32 |
|
33 |
# Main function
|
34 |
def main():
|
35 |
+
query = st.text_input("Enter your research query: ")
|
36 |
if query:
|
|
|
|
|
37 |
# Perform web search
|
38 |
search_results = web_search(query)
|
39 |
+
# Pass the search results to the AI for generating a report
|
40 |
+
report = chat_with_ai(search_results)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# Display the report
|
42 |
st.write(report)
|
43 |
|
44 |
if __name__ == "__main__":
|
45 |
+
main()
|