bkoz commited on
Commit
c705142
1 Parent(s): 1c3de9c
Files changed (2) hide show
  1. 00-sandbox.py +23 -0
  2. app.py +8 -1
00-sandbox.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def fibonacci(n: int) -> list:
2
+ """
3
+ :param n:
4
+ :return:
5
+ """
6
+ if n == 0:
7
+ return []
8
+ elif n == 1:
9
+ return [0]
10
+ elif n == 2:
11
+ return [0, 1]
12
+ else:
13
+ a, b = 0, 1
14
+ res = [0, 1]
15
+ for i in range(2, n):
16
+ c = a + b
17
+ res.append(c)
18
+ a, b = b, c
19
+ return res
20
+
21
+
22
+ if __name__ == '__main__':
23
+ print(fibonacci(10))
app.py CHANGED
@@ -29,8 +29,15 @@ def generate(prompt):
29
  r = response[0]['generated_text']
30
  return r
31
 
 
 
 
 
 
 
32
  gr.Interface(
33
  fn=generate,
34
- inputs=gr.Text("def fibonacci(n: int) -> List:\n"),
35
  outputs=gr.Text(),
 
36
  ).launch()
 
29
  r = response[0]['generated_text']
30
  return r
31
 
32
+ input_textbox = gr.Textbox(
33
+ label="Code goes here",
34
+ info="Initial code",
35
+ lines=3,
36
+ value="def fibonacci(n: int) -> List:\n",
37
+ )
38
  gr.Interface(
39
  fn=generate,
40
+ inputs=input_textbox,
41
  outputs=gr.Text(),
42
+ title=model
43
  ).launch()