File size: 1,407 Bytes
d70cb22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()