|
import gradio as gr |
|
from flask import Flask, render_template |
|
|
|
app = Flask(__name__) |
|
def my_function_1(name): |
|
return "dfd" |
|
|
|
def gradio_interface_1(): |
|
interface = gr.Interface( |
|
fn=my_function_1, |
|
inputs="text", |
|
outputs="text", |
|
) |
|
return interface |
|
|
|
def gradio_interface_2(): |
|
interface = gr.Interface( |
|
fn=my_function_1, |
|
inputs="image", |
|
outputs="text", |
|
) |
|
return interface |
|
|
|
|
|
gr_interface_1 = gradio_interface_1() |
|
gr_interface_2 = gradio_interface_2() |
|
|
|
|
|
@app.route('/') |
|
def home(): |
|
return render_template('index.html') |
|
|
|
@app.route('/interface1') |
|
def interface1(): |
|
return gr_interface_1.launch() |
|
|
|
@app.route('/interface2') |
|
def interface2(): |
|
return gr_interface_2.launch() |
|
|
|
if __name__ == '__main__': |
|
app.run(debug=True) |
|
|