chenkw1029 commited on
Commit
e7e0158
·
verified ·
1 Parent(s): df5a6d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -8,7 +8,7 @@ from transformers import pipeline, set_seed
8
  set_seed(42)
9
 
10
  # 从环境变量获取 token(现在应该可以正常工作了)
11
- HF_TOKEN = os.environ.get('ProtTex')
12
  print(f"Token 状态: {'已设置' if HF_TOKEN else '未设置'}")
13
 
14
  # 初始化模型管道
@@ -113,16 +113,9 @@ def generate_protein(instruction, max_length=100):
113
  except Exception as e:
114
  yield f"❌ 生成过程中出现未预期错误: {str(e)}"
115
 
116
- # 创建界面
117
  with gr.Blocks(
118
- title="ProtTeX 蛋白质生成器",
119
- theme=gr.themes.Soft(),
120
- css="""
121
- .gradio-container {
122
- max-width: 900px;
123
- margin: auto;
124
- }
125
- """
126
  ) as demo:
127
 
128
  gr.Markdown("""
@@ -160,8 +153,7 @@ with gr.Blocks(
160
  output = gr.Textbox(
161
  label="🧬 生成的蛋白质序列",
162
  lines=8,
163
- show_copy_button=True,
164
- elem_id="output-box"
165
  )
166
 
167
  # 示例部分
 
8
  set_seed(42)
9
 
10
  # 从环境变量获取 token(现在应该可以正常工作了)
11
+ HF_TOKEN = os.environ.get('HF_TOKEN')
12
  print(f"Token 状态: {'已设置' if HF_TOKEN else '未设置'}")
13
 
14
  # 初始化模型管道
 
113
  except Exception as e:
114
  yield f"❌ 生成过程中出现未预期错误: {str(e)}"
115
 
116
+ # 创建界面 - 修复了 theme 参数问题
117
  with gr.Blocks(
118
+ title="ProtTeX 蛋白质生成器"
 
 
 
 
 
 
 
119
  ) as demo:
120
 
121
  gr.Markdown("""
 
153
  output = gr.Textbox(
154
  label="🧬 生成的蛋白质序列",
155
  lines=8,
156
+ show_copy_button=True
 
157
  )
158
 
159
  # 示例部分