Spaces:
Runtime error
Runtime error
Commit
·
933f883
1
Parent(s):
283bb39
Upload app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import json
|
|
| 13 |
|
| 14 |
st.title('StackOverflow Question Demo')
|
| 15 |
|
| 16 |
-
library = st.radio('Select a library', ('numpy', 'tensorflow
|
| 17 |
|
| 18 |
question_path = './{}.txt'.format(library)
|
| 19 |
# loading stackoverflow questions.
|
|
@@ -23,6 +23,88 @@ question_path = './{}.txt'.format(library)
|
|
| 23 |
#def load_data(path):
|
| 24 |
# return load_dataset('text', data_files = path, cache_dir = './data')
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
dataset = []
|
| 28 |
#dataset = load_data(question_path)
|
|
|
|
| 13 |
|
| 14 |
st.title('StackOverflow Question Demo')
|
| 15 |
|
| 16 |
+
library = st.radio('Select a library', ('numpy', 'tensorflow+ pytorch', 'scipy', 'scikit-learn', 'pandas'))
|
| 17 |
|
| 18 |
question_path = './{}.txt'.format(library)
|
| 19 |
# loading stackoverflow questions.
|
|
|
|
| 23 |
#def load_data(path):
|
| 24 |
# return load_dataset('text', data_files = path, cache_dir = './data')
|
| 25 |
|
| 26 |
+
intro = {'numpy': '''
|
| 27 |
+
#### Setup
|
| 28 |
+
temperature = 0.7, topP = 0.95, turns = 10
|
| 29 |
+
|
| 30 |
+
#### Prompt:
|
| 31 |
+
|
| 32 |
+
Problem:
|
| 33 |
+
……
|
| 34 |
+
|
| 35 |
+
A:
|
| 36 |
+
|
| 37 |
+
<code>
|
| 38 |
+
……
|
| 39 |
+
###BEGIN SOLUTION
|
| 40 |
+
[insert]
|
| 41 |
+
###END SOLUTION
|
| 42 |
+
…
|
| 43 |
+
</code>
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
A0: change example
|
| 47 |
+
|
| 48 |
+
A1: change logits(decimal places, array, etc)
|
| 49 |
+
|
| 50 |
+
A2: change output type (array -> dict, etc)
|
| 51 |
+
|
| 52 |
+
A3: analogy
|
| 53 |
+
|
| 54 |
+
A4: dimension(index) involved
|
| 55 |
+
|
| 56 |
+
A5: inverted operation
|
| 57 |
+
|
| 58 |
+
A6: order
|
| 59 |
+
|
| 60 |
+
A7: ±condition/operation
|
| 61 |
+
|
| 62 |
+
combinations involved, only show the highest level.
|
| 63 |
+
|
| 64 |
+
''',
|
| 65 |
+
'scipy':
|
| 66 |
+
'''
|
| 67 |
+
Setup
|
| 68 |
+
temperature = 0.7, topP = 0.95, 10 attempts.
|
| 69 |
+
|
| 70 |
+
Prompt:
|
| 71 |
+
|
| 72 |
+
Problem:
|
| 73 |
+
……
|
| 74 |
+
|
| 75 |
+
A:
|
| 76 |
+
|
| 77 |
+
<code>
|
| 78 |
+
……
|
| 79 |
+
###BEGIN SOLUTION
|
| 80 |
+
[insert]
|
| 81 |
+
###END SOLUTION
|
| 82 |
+
…
|
| 83 |
+
</code>
|
| 84 |
+
|
| 85 |
+
Origin: original question from stackoverflow(might be specified or simplified)
|
| 86 |
+
|
| 87 |
+
Function: Let model fill in a function.
|
| 88 |
+
|
| 89 |
+
A1: paraphrasing, seems not effective to Codex.
|
| 90 |
+
|
| 91 |
+
A2: change example
|
| 92 |
+
|
| 93 |
+
A3: analogy(min->max, column->row, etc)
|
| 94 |
+
|
| 95 |
+
A6: result type constraint.
|
| 96 |
+
|
| 97 |
+
A7: ±condition/operation
|
| 98 |
+
|
| 99 |
+
'''
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
hyper_links = {'numpy':'https://docs.google.com/document/d/1WjMXfe-zV5VvKfbUnyxauTBciPB1Bp82baaIrG3XffM/edit#',
|
| 103 |
+
'scipy': 'https://docs.google.com/document/d/1u_rGiLrLbH9Ac_OueTbmDFyLlWOtB0U56Ertp8ggW1Q/edit'}
|
| 104 |
+
|
| 105 |
+
st.write(intro[library])
|
| 106 |
+
|
| 107 |
+
st.write('If the demo seems a little confusing, feel free to check the document.', hyper_links[library])
|
| 108 |
|
| 109 |
dataset = []
|
| 110 |
#dataset = load_data(question_path)
|