Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,13 @@
|
|
1 |
-
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import AutoTokenizer, AutoModel
|
3 |
+
tokenizer = AutoTokenizer.from_pretrained("silver/chatglm-6b-slim", trust_remote_code=True)
|
4 |
+
model = AutoModel.from_pretrained("silver/chatglm-6b-slim", trust_remote_code=True).half().cuda()
|
5 |
|
6 |
+
def greet(name):
|
7 |
+
response, history = model.chat(tokenizer, "你好", history=[])
|
8 |
+
#return "Hello " + name + "!!"
|
9 |
+
return response
|
10 |
+
|
11 |
|
12 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
13 |
+
iface.launch()
|