from g4f.client import Client | |
import gradio as gr | |
client = Client() | |
def chatbot_respone(user_input): | |
response = client.chat.completions.create( | |
model="gpt-4", | |
messages=[{"role": "user", "content": user_input}] | |
) | |
return response.choices[0].message.content | |
interface = gr.Interface( | |
fn=chatbot_respone, | |
inputs= gr.Textbox(lines=2), | |
outputs=["text"], | |
title="AI power up" | |
) | |
if __name__ =="__main__": | |
interface.launch(share=True) | |