File size: 1,430 Bytes
34188c9
 
 
 
 
 
 
 
b56e028
34188c9
 
b56e028
34188c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b56e028
34188c9
 
b56e028
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import streamlit as st
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

# Load pre-trained model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("avisena/bart-base-job-info-summarizer")
model = AutoModelForSeq2SeqLM.from_pretrained("avisena/bart-base-job-info-summarizer")

# Streamlit app
st.title("Job Info Summarizer")

# Text input
text_input = st.text_area("Enter the job info to summarize:", height=200)

# Summarize button
if st.button("Summarize"):
    if text_input:
        # Tokenize input text
        inputs = tokenizer.encode(text_input, return_tensors="pt", max_length=1024, truncation='do_not_truncate')

        # Generate summary
        summary_ids = model.generate(
            inputs,
            max_length=200,  # Maximum length of the summary
            min_length=30,   # Minimum length of the summary
            length_penalty=0.98,  # Penalty for longer sequences
            num_beams=6,     # Number of beams for beam search
            top_p=3.7,
            early_stopping=True,
            temperature=1.4,
            do_sample=True
        )

        # Decode summary
        summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True, max_length=512, truncation='do_not_truncate')

        # Display the summarized text
        st.subheader("Summarized Job Info")
        st.write(summary)
    else:
        st.warning("Please enter the job info to summarize.")