Spaces:
Sleeping
Sleeping
File size: 5,392 Bytes
b752d9a f01973f b752d9a 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db 4fa486b 2bdb2db f01973f b3c8dda 4fa486b b3c8dda f01973f 2bdb2db f01973f b3c8dda 2bdb2db b3c8dda 2bdb2db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | import gradio as gr
import requests
def get_data_definition():
"""
To run evaluations, you must create a Dataset object with a DataDefinition.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/data_definition.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_descriptors():
"""
How to run evaluations for text data.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/descriptors.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_evaluations():
"""
Core eval workflow.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/evaluations_overview.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_leftovers():
"""
How to handle leftover content in your dataset.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/leftover_content.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_metrics_generators():
"""
How to generate multiple metrics at once.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/metric_generator.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_output_formats():
"""
How to export the evaluation results.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/output_formats.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_overview():
"""
Get Evidently actual overview documentation.
description:
Core concepts and components of the Evidently Python library.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/overview.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_reports():
"""
How to generate Report.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/report.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_tags_and_metadata():
"""
How to add metadata to evaluations.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/tags_metadata.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
def get_tests():
"""
How to run conditional checks.
"""
try:
url = "https://raw.githubusercontent.com/evidentlyai/docs/refs/heads/main/docs/library/tests.mdx"
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
return str(e)
server = gr.TabbedInterface(
[
gr.Interface(get_data_definition, inputs=[], outputs="text", title="Data Definition"),
gr.Interface(get_descriptors, inputs=[], outputs="text", title="Descriptors"),
gr.Interface(get_evaluations, inputs=[], outputs="text", title="Evaluations"),
gr.Interface(get_leftovers, inputs=[], outputs="text", title="Leftovers"),
gr.Interface(get_metrics_generators, inputs=[], outputs="text", title="Metrics Generators"),
gr.Interface(get_output_formats, inputs=[], outputs="text", title="Output Formats"),
gr.Interface(get_overview, inputs=[], outputs="text", title="Overview"),
gr.Interface(get_reports, inputs=[], outputs="text", title="Reports"),
gr.Interface(get_tags_and_metadata, inputs=[], outputs="text", title="Tags and Metadata"),
gr.Interface(get_tests, inputs=[], outputs="text", title="Tests")
],
[
"Data Definition",
"Descriptors",
"Evaluations",
"Leftovers",
"Metrics Generators",
"Output Formats",
"Overview",
"Reports",
"Tags and Metadata",
"Tests"
],
)
# Launch the interface and MCP server
if __name__ == "__main__":
server.launch(mcp_server=True) |