Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# 模型和分词器的名称
|
5 |
-
model_name = "Qwen2.5-7B-Instruct"
|
6 |
|
7 |
# 加载模型和分词器
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
+
messages = [
|
7 |
+
{"role": "user", "content": "Who are you?"},
|
8 |
+
]
|
9 |
+
pipe = pipeline("text-generation", model="Qwen/Qwen2.5-7B-Instruct")
|
10 |
+
pipe(messages)
|
11 |
+
|
12 |
# 模型和分词器的名称
|
13 |
+
model_name = "Qwen/Qwen2.5-7B-Instruct"
|
14 |
|
15 |
# 加载模型和分词器
|
16 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|