Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,17 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# 加载 Hugging Face 上的预训练模型(以 DeepSeek 为例)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
model_name = "deepseek-ai/deepseek-7b"
|
6 |
pipe = pipeline("text-generation", model=model_name, tokenizer=model_name)
|
7 |
|
|
|
8 |
# 定义与模型对话的函数
|
9 |
def chat_with_ai(prompt):
|
10 |
# 使用模型生成文本
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# 加载 Hugging Face 上的预训练模型(以 DeepSeek 为例)
|
5 |
+
from huggingface_hub import login
|
6 |
+
from transformers import pipeline
|
7 |
+
|
8 |
+
# 登录 Hugging Face
|
9 |
+
login(token="your_huggingface_token")
|
10 |
+
|
11 |
+
# 加载模型
|
12 |
model_name = "deepseek-ai/deepseek-7b"
|
13 |
pipe = pipeline("text-generation", model=model_name, tokenizer=model_name)
|
14 |
|
15 |
+
|
16 |
# 定义与模型对话的函数
|
17 |
def chat_with_ai(prompt):
|
18 |
# 使用模型生成文本
|