Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def classify_project(desc):
|
| 4 |
+
desc_l = desc.lower()
|
| 5 |
+
scores = {"Science": 0, "Entrepreneurship": 0, "Technology": 0}
|
| 6 |
+
sci_kw = ["research","biology","clinical","drug","gene","protein","study","trial","biomedical","cancer","ml","ai","model","data","analysis"]
|
| 7 |
+
ent_kw = ["market","startup","investor","revenue","product","customer","business","venture","funding","mvp","saas","platform"]
|
| 8 |
+
tech_kw = ["software","api","library","framework","pipeline","infrastructure","tool","package","dashboard","database","cloud","deploy"]
|
| 9 |
+
for kw in sci_kw:
|
| 10 |
+
if kw in desc_l: scores["Science"] += 1
|
| 11 |
+
for kw in ent_kw:
|
| 12 |
+
if kw in desc_l: scores["Entrepreneurship"] += 1
|
| 13 |
+
for kw in tech_kw:
|
| 14 |
+
if kw in desc_l: scores["Technology"] += 1
|
| 15 |
+
total = max(sum(scores.values()), 1)
|
| 16 |
+
sphere = max(scores, key=scores.get)
|
| 17 |
+
confidence = scores[sphere] / total
|
| 18 |
+
return f"Sphere: {sphere}\nConfidence: {confidence:.0%}\nScores: {scores}"
|
| 19 |
+
|
| 20 |
+
with gr.Blocks(title="set-method") as demo:
|
| 21 |
+
gr.Markdown("# SET Method — Classify Your Project\nClassify into Science / Entrepreneurship / Technology spheres")
|
| 22 |
+
inp = gr.Textbox(label="Project Description", placeholder="Describe your project...")
|
| 23 |
+
out = gr.Textbox(label="Classification Result")
|
| 24 |
+
btn = gr.Button("Classify")
|
| 25 |
+
btn.click(classify_project, inp, out)
|
| 26 |
+
|
| 27 |
+
demo.launch()
|