set-method / app.py
TEZv's picture
Upload app.py with huggingface_hub
d70cb22 verified
raw
history blame
1.41 kB
import gradio as gr
def classify_project(desc):
desc_l = desc.lower()
scores = {"Science": 0, "Entrepreneurship": 0, "Technology": 0}
sci_kw = ["research","biology","clinical","drug","gene","protein","study","trial","biomedical","cancer","ml","ai","model","data","analysis"]
ent_kw = ["market","startup","investor","revenue","product","customer","business","venture","funding","mvp","saas","platform"]
tech_kw = ["software","api","library","framework","pipeline","infrastructure","tool","package","dashboard","database","cloud","deploy"]
for kw in sci_kw:
if kw in desc_l: scores["Science"] += 1
for kw in ent_kw:
if kw in desc_l: scores["Entrepreneurship"] += 1
for kw in tech_kw:
if kw in desc_l: scores["Technology"] += 1
total = max(sum(scores.values()), 1)
sphere = max(scores, key=scores.get)
confidence = scores[sphere] / total
return f"Sphere: {sphere}\nConfidence: {confidence:.0%}\nScores: {scores}"
with gr.Blocks(title="set-method") as demo:
gr.Markdown("# SET Method — Classify Your Project\nClassify into Science / Entrepreneurship / Technology spheres")
inp = gr.Textbox(label="Project Description", placeholder="Describe your project...")
out = gr.Textbox(label="Classification Result")
btn = gr.Button("Classify")
btn.click(classify_project, inp, out)
demo.launch()