AlyxTeam commited on
Commit
6450f47
1 Parent(s): be10d84

feat: 添加默认输入

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -8,6 +8,10 @@ model = AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-code', trust_r
8
 
9
  @spaces.GPU
10
  def generate(input1, input2):
 
 
 
 
11
  embeddings = model.encode(
12
  [
13
  input1,
@@ -18,6 +22,9 @@ def generate(input1, input2):
18
 
19
  gr.Interface(
20
  fn=generate,
21
- inputs=[gr.Text(), gr.Text()],
 
 
 
22
  outputs=gr.Text(),
23
  ).launch()
 
8
 
9
  @spaces.GPU
10
  def generate(input1, input2):
11
+ if len(input1) < 1:
12
+ input1 = "How do I access the index while iterating over a sequence with a for loop?"
13
+ if len(input2) < 1:
14
+ input2 = "# Use the built-in enumerator\nfor idx, x in enumerate(xs):\n print(idx, x)"
15
  embeddings = model.encode(
16
  [
17
  input1,
 
22
 
23
  gr.Interface(
24
  fn=generate,
25
+ inputs=[
26
+ gr.Text(label="input1", placeholder="How do I access the index while iterating over a sequence with a for loop?"),
27
+ gr.Text(label="input2", placeholder="# Use the built-in enumerator\nfor idx, x in enumerate(xs):\n print(idx, x)"),
28
+ ],
29
  outputs=gr.Text(),
30
  ).launch()