alessandro trinca tornidor
[feat] swich to gradio space
5d0613a
raw
history blame
838 Bytes
import logging
import gradio as gr
from fastapi import FastAPI
from app_gradio_fastapi import routes
from app_gradio_fastapi.helpers.formatters import request_formatter
from app_gradio_fastapi.helpers.session_logger import change_logging
change_logging()
logging.info("creating FastAPI app...")
CUSTOM_GRADIO_PATH = "/"
app = FastAPI(title="logging_app", version="1.0")
app.include_router(routes.router)
logging.info("FastAPI app created, creating gradio app...")
io = gr.Interface(
request_formatter,
inputs=[
gr.Textbox(lines=1, placeholder=10, label="write a number to divide 100 (0 will raise division by zero error)"),
],
outputs=[
gr.Textbox(lines=1, placeholder=None, label="Text Output"),
],
)
app = gr.mount_gradio_app(app, io, path=CUSTOM_GRADIO_PATH)
logging.info("gradio app mounted")