| import gradio as gr | |
| from fastapi import FastAPI | |
| def echo(message): | |
| return message | |
| app = FastAPI() | |
| async def hello(): | |
| return {"message": "Hello, World!"} | |
| demo = gr.Interface( | |
| fn=echo, | |
| inputs="text", | |
| outputs="text", | |
| title="Echo App", | |
| description="Enter some text, and I'll echo it back to you!" | |
| ) | |
| gr.mount_gradio_app(app, demo, path="/") | |
| if __name__ == "__main__": | |
| import uvicorn | |
| uvicorn.run(app, host="0.0.0.0", port=7860) |