Spaces:
Sleeping
Sleeping
File size: 1,248 Bytes
ac2faa6 7bb2c16 ac2faa6 |
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 |
import gradio as gr
import google.generativeai as genai
# Configure your Gemini API key
genai.configure(api_key="AIzaSyCCkG05NQrWCoO9kNeWoI1Y83ltdmYKiNM") # Replace with your real key
# Use the correct model that supports text-only chat
model = genai.GenerativeModel(model_name="models/gemini-1.5-flash")
# Prediction function
def predict_role(skills):
try:
prompt = f"""
You are a smart career advisor AI. Based on the following skills: {skills}, suggest the most suitable job title.
Respond ONLY with a clear job title, like:
- Data Analyst
- Full Stack Developer
- DevOps Engineer
Don't repeat the input. Output one job title only.
"""
response = model.generate_content(prompt)
result = response.text.strip()
# Clean result
if "\n" in result:
result = result.split("\n")[0]
if result.startswith("- "):
result = result[2:]
return result
except Exception as e:
return f"❌ Error: {str(e)}"
# Gradio app
gr.Interface(
fn=predict_role,
inputs=gr.Textbox(lines=2, placeholder="e.g., Python, SQL, Docker"),
outputs="text",
title="Career Predictor",
description="Enter your tech skills. Get a predicted job title."
).launch()
|