Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from experiments.skill_knowledge_router import recommend
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def predict(question):
|
| 7 |
+
result = recommend(question)
|
| 8 |
+
|
| 9 |
+
skill = result["skill"] or "暂无推荐"
|
| 10 |
+
knowledge = "、".join(result["knowledge"]) or "暂无推荐"
|
| 11 |
+
|
| 12 |
+
return skill, knowledge
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
demo = gr.Interface(
|
| 16 |
+
fn=predict,
|
| 17 |
+
inputs=gr.Textbox(
|
| 18 |
+
label="输入你的需求",
|
| 19 |
+
placeholder="例如:帮我开发 Java ERP 采购报价系统"
|
| 20 |
+
),
|
| 21 |
+
outputs=[
|
| 22 |
+
gr.Textbox(label="推荐 Skill"),
|
| 23 |
+
gr.Textbox(label="推荐 Knowledge")
|
| 24 |
+
],
|
| 25 |
+
title="ZKCoding 智能推荐实验",
|
| 26 |
+
description="根据用户的问题推荐 Skill 和 Knowledge(规则原型)"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|