File size: 1,742 Bytes
17defca
94ba3c4
0bfc07f
17defca
0bfc07f
 
860ba92
a1d1efe
860ba92
00ab727
621adb1
2f83782
e4c2919
2f83782
 
e4c2919
00ab727
621adb1
13b2498
 
 
 
 
860ba92
13b2498
606a25d
13b2498
 
 
 
d5bcdf9
0e9fa12
 
 
13b2498
606a25d
13b2498
0e9fa12
606a25d
 
aa93c47
 
 
606a25d
 
 
0e9fa12
e354d4f
0bfc07f
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
42
43
44
45
46
47
48
49
50
import gradio as gr
from transformers import pipeline
import os 


api_key = os.environ["api_key"]

pipeline = pipeline(task="text-generation", model="nkthiebaut/summarizely", use_auth_token=api_key)


prediction_parameters = {
    "max_length": 100,
    "repetition_penalty": 2.0,
    "top_k": 1,
    "top_p": 1,
    "temperature": 2.0,
    "return_full_text": False, # remove input from output
}
def predict(job_title, skills, temperature): 
    prompt = f"Skills list: {skills} Job title: {job_title} Summary: "
    prediction_parameters["temperature"] = temperature
    predictions = pipeline(prompt, **prediction_parameters)
    return predictions[0]["generated_text"]
    

title = "Summarizely: Generate Realistic Experience Descriptions"
description = """
    Enter your job title and skills and Summarizely will generate an experience summary. 
    Summarizely is a Hackathon project by the Machine Learning team at Hired.com.
"""

interface = gr.Interface(
    predict, 
    inputs=[
        gr.Textbox(value="Full Stack Engineer", label="👩‍🔧 Job title"),
        gr.Textbox(value="HTML, React, Docker", label="🧠 Skills list"), 
        gr.Slider(0.0, 10.0, value=2.0, label="🌡 Temperature (~degree of uncertainty)"),
    ], 
    outputs=gr.Textbox(label="📚 Summary"),
    examples=[
        ["Full Stack Engineer", "React, JavaScript, HTML, PHP, Scrum, Python, SQL", 2.0],
        ["Backend Engineer", "Python, Ruby, Rails, AWS, Jenkins", 2.0],
        ["Machine Learning Engineer", "PyTorch, TensorFlow, Scikit-learn, SQL, Machine Learning, Deep Learning", 2.0]
    ],
    title=title,
    description=description,
)
interface.queue(default_enabled=False)
interface.launch(auth=("hired", os.environ["password"]))