lite_metadata: | |
gradio_version: 3.32.0 | |
liteobj_version: 0.0.7 | |
class_string: gradio.interface.Interface | |
kwargs: | |
title: gitio app | |
description: An app to recieve n numbers comma separated and spit a Random Function | |
with n variables and show 2 int inputs to evaluate the function derivative and | |
integral | |
article: null | |
thumbnail: null | |
theme: gradio/seafoam | |
css: null | |
allow_flagging: never | |
inputs: | |
- class_string: gradio.components.Textbox | |
kwargs: | |
label: function | |
- class_string: gradio.components.Number | |
kwargs: | |
label: a | |
precision: 0 | |
- class_string: gradio.components.Number | |
kwargs: | |
label: b | |
precision: 0 | |
outputs: | |
- class_string: gradio.components.Dataframe | |
kwargs: | |
label: output | |
type: array | |
fn: | |
class_string: gradify.gradify_closure | |
kwargs: | |
argmaps: | |
- label: function | |
postprocessing: null | |
- label: a | |
postprocessing: null | |
- label: b | |
postprocessing: null | |
func_kwargs: {} | |
source: "import random\nimport numpy as np\n\n\ndef random_function(n):\n \ | |
\ variables = [f'x{i}' for i in range(n)]\n function = ''\n for i in\ | |
\ range(n):\n coefficient = random.randint(-10, 10)\n function\ | |
\ += f'{coefficient}*{variables[i]} + '\n function = function[:-3]\n \ | |
\ return function\n\n\ndef evaluate_derivative_integral(function, a, b):\n\ | |
\ x = np.linspace(a, b, 1000)\n y = eval(function)\n derivative =\ | |
\ np.gradient(y, x)[0]\n integral = np.trapz(y, x)\n return [derivative,\ | |
\ integral]\n" | |