htchu Claude Opus 4.6 commited on
Commit
1ae81ee
·
1 Parent(s): 18a35af

嶺東科大AI系問答系統

Browse files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (3) hide show
  1. README.md +6 -9
  2. app.py +137 -54
  3. requirements.txt +2 -0
README.md CHANGED
@@ -1,17 +1,14 @@
1
  ---
2
- title: LD Test1
3
- emoji: 💬
4
- colorFrom: yellow
5
- colorTo: purple
6
  sdk: gradio
7
  sdk_version: 6.5.1
8
  app_file: app.py
9
  pinned: false
10
- hf_oauth: true
11
- hf_oauth_scopes:
12
- - inference-api
13
  license: apache-2.0
14
- short_description: 系所學習內容與出路問答系統
15
  ---
16
 
17
- An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
1
  ---
2
+ title: 嶺東科大AI系問答系統
3
+ emoji: 🎓
4
+ colorFrom: blue
5
+ colorTo: cyan
6
  sdk: gradio
7
  sdk_version: 6.5.1
8
  app_file: app.py
9
  pinned: false
 
 
 
10
  license: apache-2.0
11
+ short_description: 嶺東科大人工智慧應用科技系學習內容與出路問答系統
12
  ---
13
 
14
+ 嶺東科技大學人工智慧應用科技系 AI 學習內容與出路問答系統,使用 Groq API + LLaMA 3.3 70B 模型。
app.py CHANGED
@@ -1,69 +1,152 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
-
4
-
5
- def respond(
6
- message,
7
- history: list[dict[str, str]],
8
- system_message,
9
- max_tokens,
10
- temperature,
11
- top_p,
12
- hf_token: gr.OAuthToken,
13
- ):
14
- """
15
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
16
- """
17
- client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
 
 
 
 
 
 
 
 
 
 
18
 
19
- messages = [{"role": "system", "content": system_message}]
 
 
 
20
 
21
- messages.extend(history)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  messages.append({"role": "user", "content": message})
24
 
25
  response = ""
26
-
27
- for message in client.chat_completion(
28
- messages,
29
- max_tokens=max_tokens,
 
 
30
  stream=True,
31
- temperature=temperature,
32
- top_p=top_p,
33
- ):
34
- choices = message.choices
35
- token = ""
36
- if len(choices) and choices[0].delta.content:
37
- token = choices[0].delta.content
38
 
39
- response += token
40
- yield response
 
 
41
 
42
 
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
- chatbot = gr.ChatInterface(
47
- respond,
48
- additional_inputs=[
49
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
50
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
51
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
52
- gr.Slider(
53
- minimum=0.1,
54
- maximum=1.0,
55
- value=0.95,
56
- step=0.05,
57
- label="Top-p (nucleus sampling)",
58
- ),
59
- ],
60
- )
61
-
62
- with gr.Blocks() as demo:
63
- with gr.Sidebar():
64
- gr.LoginButton()
65
- chatbot.render()
 
 
 
66
 
 
 
 
 
 
 
 
 
67
 
68
  if __name__ == "__main__":
69
  demo.launch()
 
1
  import gradio as gr
2
+ from groq import Groq
3
+ import os
4
+
5
+ GROQ_API_KEY = os.environ.get("GROQ_API_KEY", "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")
6
+
7
+ SYSTEM_PROMPT = """你是嶺東科技大學「人工智慧應用科技系」的 AI 學習助理,專門回答有關本系課程規劃、職涯出路、教學設備、師資、招生等問題。
8
+ 請根據以下系所資訊來回答問題,回答時保持親切、專業、條理清晰。如果問題超出以下資訊範圍,請誠實告知並建議聯繫系辦。
9
+ 支援繁體中文與英文問答,依使用者語言回覆。
10
+
11
+ ===== 系所基本資訊 =====
12
+ 系名:人工智慧應用科技系(Department of Artificial Intelligence Application Technology)
13
+ 地點:台中市南屯區嶺東路一號 仙庭樓5樓 HT506
14
+ 電話:04-2389-2088 分機3751
15
+ Email:ltuai@teamil.ltu.edu.tw
16
+ 網站:https://ai.ltu.edu.tw/
17
+
18
+ ===== 培育目標 =====
19
+ 培養具備 AI 理論、資料科學能力與跨域應用實務的專業人才,使學生能將人工智慧技術與其他學科結合,創造新型態的智慧應用。鼓勵學生修習其他專業科系作為輔系,成為AI+X跨域整合人才。
20
+
21
+ ===== 六大核心能力 =====
22
+ 1. AI技術實作與系統開發能力 — 運用Python、TensorFlow、PyTorch等工具,設計機器學習及深度學習模型
23
+ 2. 資料科學與即時處理能力 — 資料擷取、清洗、分析與視覺化,邊緣運算與物聯網高效率系統
24
+ 3. AI+X跨領域整合與創新應用能力 — 結合興趣或輔修領域,提出AI驅動的創新解決方案
25
+ 4. 工程倫理與永續發展意識 — 理解AI對社會、隱私、公平性與環境的潛在影響
26
+ 5. 團隊協作與溝通表達能力 — 技術文件撰寫與專案簡報
27
+ 6. 自主學習與終身成長能力 — 追蹤新知,參與開源社群、技術競賽或專業認證
28
 
29
+ ===== 課程架構(紮根AI核心、深耕應用場域、驅動跨域創新)=====
30
+ 【AI核心技術模組】機器學習、深度學習、自然語言處理、電腦視覺、生成式AI、MLOps
31
+ 【智慧應用場域模組】三大發展主軸:智慧農業、智慧載具、智能體(Agent)軟體開發
32
+ 【跨域整合實踐模組】結合管理、設計、製造、永續等領域知識
33
 
34
+ 大一課程:Python程式設計、計算機概論、微積分、人工智慧概論、數位邏輯等基礎課程
35
+ 大二課程:資料結構、資料庫管理、機器學習基礎、物聯網概論、統計學,並開始參與實作專題
36
+ 大三課程:深度學習、電腦視覺、自然語言處理、雲端運算、邊緣運算、智慧農業/載具應用
37
+ 大四課程:生成式AI應用、MLOps、產學合作專題、畢業專題、業界實習
38
+
39
+ 技術工具涵蓋:
40
+ - 雲端AI平台:AWS、Azure、Google Vertex AI
41
+ - 邊緣AI硬體:NVIDIA Jetson、Raspberry Pi、Arduino
42
+ - 開發框架:Python、TensorFlow、PyTorch
43
+
44
+ ===== 教學與發展特色 =====
45
+ 核心理念:「應用驅動、場域導向、人才落地」
46
+ 1. 場景導向教學 — 以應用場景定義技術學習
47
+ 2. 三大發展軸心:
48
+ - 代理軟體開發:與IBM合作導入watsonx.ai平台
49
+ - 智慧農業:農田監控、病蟲害辨識、產量預測
50
+ - 智慧載具:無人機、自駕車、ROS系統應用
51
+ 3. 專題導向學習 — 自大二參與實作專題,逐年進階至跨領域整合與產學合作
52
+ 4. 端邊雲雙軌訓練 — Jetson、Raspberry Pi到AWS、GCP、Azure
53
+ 5. 產學合作 — 與興農科技、裕美生技等企業合作,設置AI應用驗證基地
54
+ 6. AI倫理培育 — 重視資料隱私、社會責任與技術倫理
55
+
56
+ ===== 專業設備 =====
57
+ 1. 高階AI運算伺服器 — 採用IBM watsonx AI管理平台技術,提供企業級AI計算能力
58
+ 2. 智慧物聯網AIoT特色教室 — 專門設計用於物聯網與人工智慧整合教學,配備各式感測器、NVIDIA Jetson開發板、Raspberry Pi、Arduino等邊緣運算設備,支援智慧農業監控、智慧載具控制等實作課程與專題研究
59
+
60
+ ===== 就業與職涯發展 =====
61
+ 目標:「畢業即就業、就業即高薪」
62
+ 熱門職位起薪(104/1111人力銀行 2024-2025統計):
63
+ - AI工程師:45,000–65,000元/月
64
+ - 資料科學與大數據工程師:48,000–70,000元/月
65
+ - Edge AI / IoT工程師:42,000–60,000元/月
66
+ - 智慧載具系統工程師:45,000–68,000元/月
67
+ - 生成式AI應用工程師:50,000–75,000+元/月
68
+ - AI解決方案顧問:48,000–65,000元/月
69
+
70
+ 重點就業產業:半導體與電子製造(台積電、聯發科等)、智慧製造、金融科技、智慧農業、無人載具與機器人、軟體與雲端服務
71
+
72
+ 職涯支持:
73
+ - 超過10家企業產學合作
74
+ - 作品集導向課程
75
+ - 年度AI就業博覽會
76
+ - 國際認證輔導(AWS AI、ITS AI等)
77
+ - 可銜接國內外AI相關研究所深造
78
+ - 具備實作作品集者,起薪普遍高出10–20%
79
+ """
80
+
81
+ EXAMPLES = [
82
+ ["課程規劃:資工系大一必修的程式課是什麼?"],
83
+ ["職涯出路:畢業後可以找哪些工作?平均薪資?"],
84
+ ["What courses prepare me for AI careers?"],
85
+ ["教學設備:介紹智慧物聯網AIoT特色教室"],
86
+ ]
87
+
88
+ client = Groq(api_key=GROQ_API_KEY)
89
+
90
+
91
+ def respond(message, history):
92
+ messages = [{"role": "system", "content": SYSTEM_PROMPT}]
93
+
94
+ for msg in history:
95
+ messages.append({"role": msg["role"], "content": msg["content"]})
96
 
97
  messages.append({"role": "user", "content": message})
98
 
99
  response = ""
100
+ stream = client.chat.completions.create(
101
+ model="llama-3.3-70b-versatile",
102
+ messages=messages,
103
+ max_tokens=1024,
104
+ temperature=0.7,
105
+ top_p=0.95,
106
  stream=True,
107
+ )
 
 
 
 
 
 
108
 
109
+ for chunk in stream:
110
+ if chunk.choices[0].delta.content:
111
+ response += chunk.choices[0].delta.content
112
+ yield response
113
 
114
 
115
+ with gr.Blocks(
116
+ title="嶺東科大 AI系學習問答系統",
117
+ theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
118
+ css="""
119
+ .header { text-align: center; margin-bottom: 10px; }
120
+ .header h1 { color: #1a5276; margin-bottom: 5px; }
121
+ .header p { color: #555; font-size: 14px; }
122
+ .examples-row { margin-top: 10px; }
123
+ """
124
+ ) as demo:
125
+
126
+ gr.HTML("""
127
+ <div class="header">
128
+ <h1>🎓 嶺東科技大學 人工智慧應用科技系</h1>
129
+ <h3>AI 學習內容與出路問答系統</h3>
130
+ <p>歡迎詢問課程規劃、職涯發展、教學設備等問題|支援中文與英文問答</p>
131
+ </div>
132
+ """)
133
+
134
+ chatbot = gr.ChatInterface(
135
+ fn=respond,
136
+ type="messages",
137
+ examples=EXAMPLES,
138
+ examples_per_page=4,
139
+ chatbot=gr.Chatbot(height=480, placeholder="💬 請輸入您的問題,例如:大一要上哪些課?"),
140
+ )
141
 
142
+ gr.HTML("""
143
+ <div style="text-align:center; margin-top:15px; padding:10px; background:#f0f4f8; border-radius:8px;">
144
+ <p style="margin:0; color:#666; font-size:13px;">
145
+ 📍 台中市南屯區嶺東路一號 仙庭樓5樓 HT506 | ☎ 04-2389-2088 #3751 |
146
+ 🌐 <a href="https://ai.ltu.edu.tw/" target="_blank">ai.ltu.edu.tw</a>
147
+ </p>
148
+ </div>
149
+ """)
150
 
151
  if __name__ == "__main__":
152
  demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ groq