radames's picture
radames HF staff
remove these to use default 0.0.0.0:7860
cb53c7e
from qa_on_context import *
import gradio as gr
example_sample = [
"Margarita with a Straw is a 2014 Indian Hindi-language drama film directed by Shonali Bose. It stars Kalki Koechlin (pictured) as an Indian teenager with cerebral palsy who relocates to America for her undergraduate education and comes of age following her complex relationship with a blind girl",
"飓风格特是1993年9月在墨西哥和整个中美洲引发严重洪灾的大规模热带气旋,源于9月14日西南加勒比海上空一股东风波。次日从尼加拉瓜登岸,经过洪都拉斯后于9月17日在洪都拉斯湾再次达到热带风暴标准,但次日进入伯利兹上空后就减弱成热带低气压。穿过尤卡坦半岛后,在9月20日强化成二级飓风,从韦拉克鲁斯州的图斯潘附近登陆墨西哥。9月21日从纳亚里特州进入太平洋时已降级成热带低气压,最终于5天后在开放水域上空消散。",
]
def demo_func(text):
assert type(text) == type("")
req = []
output = gen_qst_to_df(text)
for ele in output:
if hasattr(ele, "size"):
req.append(ele.values.tolist())
return {"output": req}
demo = gr.Interface(
fn=demo_func,
inputs="text",
outputs="json",
title=f"Question generate 🍩 demonstration",
description = 'This _example_ was **drive** from <br/><b><h4>[https://github.com/svjack/docvqa-gen](https://github.com/svjack/docvqa-gen)</h4></b>\n',
examples=example_sample if example_sample else None,
cache_examples = False
)
demo.launch()