mishig HF staff commited on
Commit
ff252b2
1 Parent(s): 3423c34

side by side phind vs wizrdcoder

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. reference.py +47 -0
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Code Llama - Playground
3
- emoji: 🦙💻🦙
4
  colorFrom: blue
5
  colorTo: indigo
6
  sdk: gradio
 
1
  ---
2
+ title: Phind VS WizardCoder - Playground
3
+ emoji: 💻⚔️💻
4
  colorFrom: blue
5
  colorTo: indigo
6
  sdk: gradio
reference.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+ import itertools
4
+
5
+ # First stream: Generates numbers from 0 to 9
6
+ def stream_numbers():
7
+ for i in range(10):
8
+ time.sleep(1)
9
+ yield i
10
+ return 5
11
+ return 69
12
+
13
+ # Second stream: Generates squares of numbers from 0 to 5 (intentionally shorter)
14
+ def stream_squares():
15
+ for i in range(6):
16
+ time.sleep(1)
17
+ yield i * i
18
+ return 5
19
+ return 69
20
+
21
+ def interface_func():
22
+ numbers = stream_numbers()
23
+ squares = stream_squares()
24
+
25
+ for _ in range(10):
26
+ num = None
27
+ sqr = None
28
+
29
+ try:
30
+ num = next(numbers)
31
+ except StopIteration:
32
+ pass
33
+
34
+ try:
35
+ sqr = next(squares)
36
+ except StopIteration:
37
+ pass
38
+
39
+ yield (str(num) if num is not None else "Finished",
40
+ str(sqr) if sqr is not None else "Finished")
41
+
42
+ demo = gr.Interface(
43
+ fn=interface_func,
44
+ inputs=[],
45
+ outputs=["text", "text"]
46
+ )
47
+ demo.queue().launch()