CassandraG/RecommendationsGeneratorCassandra
0
1import openai2import os3import gradio as gr4 5openai.api_key = os.environ["OPENAI_API_KEY"]6 7def get_recommendation(prompt, recommendation_type):8 if recommendation_type == "Letter of Recommendation":9 context = f"Write a Letter of Recommendation for a job addressed to hiring manager for a candidate who is female/she named Cassandra who is a recruiting professional without mention of time worked together and follow this instructions: {prompt}"10 else:11 context = f"Write a Recommendation for LinkedIn for a candidate who is female/she named Cassandra who is a recruiting professional without mention of time worked together and follow this instructions: {prompt}"12 13 response = openai.Completion.create(14 engine="text-davinci-003",15 prompt=context,16 temperature=0.6,17 max_tokens=3000,18 top_p=1,19 frequency_penalty=0,20 presence_penalty=021 )22 23 return response.choices[0].text.strip()24 25inputs = [26 gr.inputs.Radio(choices=["Letter of Recommendation", "LinkedIn Recommendation"], label="Recommendation Type"),27 gr.inputs.Textbox(lines=7, label="Description")28]29 30outputs = gr.outputs.Textbox(label="Reply")31 32gr.Interface(fn=get_recommendation, inputs=inputs, outputs=outputs, title="Recommendation Generator", description="Describe what you enjoyed and observed while working with Cassandra. Choose the type of recommendation you want.", theme="compact").launch()33 