wanicca commited on
Commit
3e997b3
·
1 Parent(s): cf5b288

app remove ctx processing

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -40,13 +40,13 @@ def infer(
40
  token_ban = [0], # ban the generation of some tokens
41
  token_stop = []) # stop generation whenever you see any token here
42
 
43
- ctx = ctx.strip().split('\n')
44
- for c in range(len(ctx)):
45
- ctx[c] = ctx[c].strip().strip('\u3000').strip('\r')
46
- ctx = list(filter(lambda c: c != '', ctx))
47
- ctx = '\n' + ('\n'.join(ctx)).strip()
48
- if ctx == '':
49
- ctx = '\n'
50
 
51
  # gpu_info = nvmlDeviceGetMemoryInfo(gpu_h)
52
  # print(f'vram {gpu_info.total} used {gpu_info.used} free {gpu_info.free}',flush=True)
@@ -127,7 +127,7 @@ examples = [
127
 
128
  iface = gr.Interface(
129
  fn=infer,
130
- description=f'''这是GalGame剧本续写模型(实验性质,不保证效果)。<b>请点击例子(在页面底部)</b>,可编辑内容。这里只看输入的最后约1200字,请写好,标点规范,无错别字,否则电脑会模仿你的错误。<b>为避免占用资源,每次生成限制长度。可将输出内容复制到输入,然后继续生成</b>。推荐提高temp改善文采,降低topp改善逻辑,提高两个penalty避免重复,具体幅度请自己实验。{desc}''',
131
  allow_flagging="never",
132
  inputs=[
133
  gr.Textbox(lines=10, label="Prompt 输入的前文", value="通过基因改造,修真"), # prompt
 
40
  token_ban = [0], # ban the generation of some tokens
41
  token_stop = []) # stop generation whenever you see any token here
42
 
43
+ # ctx = ctx.strip().split('\n')
44
+ # for c in range(len(ctx)):
45
+ # ctx[c] = ctx[c].strip().strip('\u3000').strip('\r')
46
+ # ctx = list(filter(lambda c: c != '', ctx))
47
+ # ctx = '\n' + ('\n'.join(ctx)).strip()
48
+ # if ctx == '':
49
+ # ctx = '\n'
50
 
51
  # gpu_info = nvmlDeviceGetMemoryInfo(gpu_h)
52
  # print(f'vram {gpu_info.total} used {gpu_info.used} free {gpu_info.free}',flush=True)
 
127
 
128
  iface = gr.Interface(
129
  fn=infer,
130
+ description=f'''这是GalGame剧本续写模型(实验性质,不保证效果)。<b>请点击例子(在页面底部)</b>,可编辑内容。这里只看输入的最后约1200字,请写好,标点规范,无错别字,否则电脑会模仿你的错误。<b>为避免占用资源,每次生成限制长度。可将输出内容复制到输入,然后继续生成</b>。推荐提高temp改善文采,降低topp改善逻辑,提高两个penalty避免重复,具体幅度请自己实验。<br /> {desc}''',
131
  allow_flagging="never",
132
  inputs=[
133
  gr.Textbox(lines=10, label="Prompt 输入的前文", value="通过基因改造,修真"), # prompt