api / app.py
Josejc00's picture
Create app.py
8f1d0f8
import g4f
import g4f.api
import gradio as gr
# Your existing g4f server code
if __name__ == "__main__":
print(f'Starting server... [g4f v-{g4f.version}]')
g4f.api.Api(engine=g4f, debug=True).run(ip="127.0.0.1:1337")
# Gradio Interface
iface = gr.Interface(
fn=None, # You should replace None with your function that interacts with the g4f engine
live=True,
capture_session=True,
inputs=[gr.Textbox("Input text", default="")],
outputs="text",
title="g4f Gradio Interface",
description="Interact with g4f engine through Gradio.",
)
iface.launch()