|
import streamlit as st |
|
import requests |
|
|
|
|
|
session = requests.Session() |
|
|
|
|
|
def chat_with_ai(message): |
|
api_url = "https://free-ai-api.devastation-war.repl.co/chat" |
|
payload = {"message": message} |
|
|
|
try: |
|
with session.post(api_url, json=payload) as response: |
|
if response.status_code == 200: |
|
return response.json().get('response') |
|
else: |
|
return {"error": "Failed to get a response from the AI API."} |
|
except requests.RequestException as e: |
|
return {"error": f"Error: {e}"} |
|
|
|
|
|
def web_search(query): |
|
url = "https://test.devastation-war.repl.co/search" |
|
payload = {"query": query} |
|
response = requests.post(url, json=payload) |
|
|
|
if response.status_code == 200: |
|
return response.json().get('results') |
|
else: |
|
return {"error": f"Error: {response.status_code}"} |
|
|
|
|
|
def main(): |
|
query = st.text_area("Enter resume content:") |
|
if query: |
|
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}" |
|
|
|
|
|
search_results = web_search(query) |
|
|
|
|
|
message = "" |
|
for result in search_results: |
|
|
|
message += result + ". " |
|
|
|
|
|
full_message = prompt + " " + message |
|
|
|
|
|
report = chat_with_ai(full_message) |
|
|
|
|
|
st.write(report) |
|
|
|
if __name__ == "__main__": |
|
main() |