Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ tokenizer = T5Tokenizer.from_pretrained("ClueAI/ChatYuan-large-v2")
|
|
7 |
model = T5ForConditionalGeneration.from_pretrained("ClueAI/ChatYuan-large-v2").half()
|
8 |
# 使用
|
9 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
10 |
-
|
11 |
|
12 |
def preprocess(text):
|
13 |
text = text.replace("\n", "\\n").replace("\t", "\\t")
|
@@ -101,6 +101,7 @@ block = gr.Blocks()
|
|
101 |
with block as demo_1:
|
102 |
gr.Markdown("""<h1><center>元语智能——ChatYuan</center></h1>
|
103 |
<font size=4>回答来自ChatYuan, 以上是模型生成的结果, 请谨慎辨别和参考, 不代表任何人观点</font>
|
|
|
104 |
<font size=4>在使用此功能前,你需要有个API key. API key 可以通过这个<a href='https://www.clueai.cn/' target="_blank">平台</a>获取</font>
|
105 |
""")
|
106 |
api_key = gr.inputs.Textbox(label="请输入你的api-key(必填)", default="", type='password')
|
|
|
7 |
model = T5ForConditionalGeneration.from_pretrained("ClueAI/ChatYuan-large-v2").half()
|
8 |
# 使用
|
9 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
10 |
+
model.to(device)
|
11 |
|
12 |
def preprocess(text):
|
13 |
text = text.replace("\n", "\\n").replace("\t", "\\t")
|
|
|
101 |
with block as demo_1:
|
102 |
gr.Markdown("""<h1><center>元语智能——ChatYuan</center></h1>
|
103 |
<font size=4>回答来自ChatYuan, 以上是模型生成的结果, 请谨慎辨别和参考, 不代表任何人观点</font>
|
104 |
+
|
105 |
<font size=4>在使用此功能前,你需要有个API key. API key 可以通过这个<a href='https://www.clueai.cn/' target="_blank">平台</a>获取</font>
|
106 |
""")
|
107 |
api_key = gr.inputs.Textbox(label="请输入你的api-key(必填)", default="", type='password')
|