Spaces:
Sleeping
Sleeping
"""Talk to spaces VM via subprocess.check_output.""" | |
# pylint: disable=wrong-import-position | |
import sys | |
from pathlib import Path | |
if "." not in sys.path: | |
sys.path.insert(0, ".") | |
# import httpx | |
import subprocess as sp | |
from shlex import split | |
import pandas as pd | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
# from textwrap import dedent | |
from inspect import cleandoc | |
import gradio as gr | |
import logzero | |
from logzero import logger | |
# from gradiobee.seg_text import seg_text | |
matplotlib.use("Agg") # non-interactive for plt.savefig | |
sns.set() | |
sns.set_style("darkgrid") | |
logzero.loglevel() # default to 10 | |
def fn(): | |
df = pd.DataFrame(data={'x': [1, 2], 'y': [3, 4], "cos": [0.1, 0.5]}) | |
return df, df.to_html() | |
iface = gr.Interface( | |
fn=fn, | |
outputs=["dataframe", "html"], | |
title="Test dataframe and html", | |
description="Test dataframe and html", | |
# layout="vertical", | |
) | |
iface.launch(share=False, debug=True) | |
# iface.launch() |