gradio-streamlit / app_gradio.py
eienmojiki's picture
Create app_gradio.py
f0018cc verified
from fastapi import FastAPI
import gradio as gr
# Khởi tạo ứng dụng FastAPI
app = FastAPI()
# Hàm xử lý của Gradio
def greet(name):
return "Hello " + name + "!"
# Tạo giao diện Gradio
gr_interface = gr.Interface(fn=greet, inputs="text", outputs="text", title="Gradio Space Example")
# Gắn Gradio vào FastAPI
# Endpoint này sẽ được proxy_pass qua Nginx
app = gr.mount_gradio_app(app, gr_interface, path="/")