"""Run api.""" from typing import Dict import gradio as gr from gradio_ttw_api.hit import hit def ttw_api(query: str) -> Dict: "Prep api.""" try: hit_ = hit(query) except Exception as exc: hit_ = str(exc) return { "xyz": f"Hello {query} !!", "abc": "dummy", "hit": hit_, } iface = gr.Interface(fn=ttw_api, inputs="text", outputs="json") iface.launch(live=True)