hhyxnh commited on
Commit
10a122a
1 Parent(s): 37eab21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -1,6 +1,17 @@
1
  import gradio as gr
2
  import random
3
  import time
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  # 假设这是队标的URL或本地路径
6
  team_logo_url = './team-logo.jpg' # 替换为你的队标图片路径
@@ -32,7 +43,6 @@ _我们诚挚地感谢您的支持与反馈。_
32
  _feedback email:hhyxnh@gmail_
33
 
34
 
35
-
36
  """
37
 
38
  with gr.Blocks() as demo:
 
1
  import gradio as gr
2
  import random
3
  import time
4
+ from transformers import AutoModelForQuestionAnswering, pipeline
5
+
6
+ # 设置使用GPU
7
+ device = "cuda" if torch.cuda.is_available() else "cpu"
8
+
9
+ # 初始化模型
10
+ model_name = "bert-base-uncased"
11
+ model = AutoModelForQuestionAnswering.from_pretrained(model_name).to(device)
12
+
13
+ # 创建管道
14
+ qa_pipeline = pipeline("question-answering", model=model, tokenizer=model_name)
15
 
16
  # 假设这是队标的URL或本地路径
17
  team_logo_url = './team-logo.jpg' # 替换为你的队标图片路径
 
43
  _feedback email:hhyxnh@gmail_
44
 
45
 
 
46
  """
47
 
48
  with gr.Blocks() as demo: