ResumeRewriter / app.py
Abhilashvj's picture
Update app.py
16b2878
import os
import requests
from io import BytesIO
import base64
import streamlit as st
import requests
AUTH_TOKEN = st. secrets["AUTH_TOKEN"]
headers = {"Authorization": f"Bearer {AUTH_TOKEN}"}
st.set_page_config(page_title="Image Similarity", page_icon="πŸŽ†πŸŽ‡")
CHAT_API = "https://abhilashvj-chat-api.hf.space/"
# IMAGE_SIMILARITY_DEMO = "http://127.0.0.1:8000/find-similar-image-pinecone/"
TMP_DIR = "./tmp"
os.makedirs(TMP_DIR, exist_ok=True)
st.title("Resume Reframing App")
# Uploading files using Streamlit
resume_file = st.file_uploader("Upload Resume", type=["txt", "pdf"])
template_file = st.file_uploader("Upload Template (Optional)", type=["txt", "pdf"], accept_multiple_files=False)
job_description_file = st.file_uploader("Upload Job Description (Optional)", type=["txt", "pdf"], accept_multiple_files=False)
# Inputs for QueryData
text_input = st.text_input("Enter your text:", "Your text here")
top_k = st.number_input("Top K", min_value=1, max_value=100, value=5)
primer = st.text_input("Enter primer:", "Your primer here")
if st.button("Submit"):
if resume_file:
# The URL to your FastAPI endpoint
url = f"{CHAT_API}/upload/"
# Setting up the data for the `QueryData` model
data = {
"text": text_input,
"top_k": top_k,
"primer": primer,
}
files = {"resume": resume_file.getvalue()}
if template_file:
files["template"] = template_file.getvalue()
if job_description_file:
files["job_description"] = job_description_file.getvalue()
# Making the POST request
response = requests.post(url, data=data, files=files)
# Displaying the response
st.write(response.json())
else:
st.warning("Please upload a resume!")