Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,20 +28,9 @@ def code_summarizer(code):
|
|
| 28 |
return summary[0]['summary_text']
|
| 29 |
|
| 30 |
def call_examples():
|
| 31 |
-
examples =
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
sum = sum + x
|
| 35 |
-
average = sum / len(list)
|
| 36 |
-
return average'''],
|
| 37 |
-
['''def findMax(list):
|
| 38 |
-
max = list[0]
|
| 39 |
-
for x in list:
|
| 40 |
-
if x > max:
|
| 41 |
-
max = x
|
| 42 |
-
return max'''],
|
| 43 |
-
['''def findRange(list):
|
| 44 |
-
return max(list)-min(list)''']]
|
| 45 |
return examples
|
| 46 |
|
| 47 |
gr.Interface(fn=code_summarizer,
|
|
@@ -56,5 +45,6 @@ gr.Interface(fn=code_summarizer,
|
|
| 56 |
title='Code Summarizer From CodeTrans',
|
| 57 |
description='Summarize any Python code',
|
| 58 |
theme='dark-peach',
|
|
|
|
| 59 |
examples=call_examples(),
|
| 60 |
allow_flagging='never').launch(inbrowser=True)
|
|
|
|
| 28 |
return summary[0]['summary_text']
|
| 29 |
|
| 30 |
def call_examples():
|
| 31 |
+
examples = {'Example 1' : '''def findAverage(list): sum = 0. for x in list: sum = sum + x average = sum / len(list) return average''',
|
| 32 |
+
'Example 2' : '''def findMax(list): max = list[0] for x in list: if x > max: max = x return max''',
|
| 33 |
+
'Example 3' : '''def findRange(list): return max(list)-min(list)'''}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
return examples
|
| 35 |
|
| 36 |
gr.Interface(fn=code_summarizer,
|
|
|
|
| 45 |
title='Code Summarizer From CodeTrans',
|
| 46 |
description='Summarize any Python code',
|
| 47 |
theme='dark-peach',
|
| 48 |
+
live=True,
|
| 49 |
examples=call_examples(),
|
| 50 |
allow_flagging='never').launch(inbrowser=True)
|