import gradio as gr import openai # Replace "YOUR_OPENAI_API_KEY" with your actual OpenAI API key openai_api_key = "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" def chatbot(question): message_log = [ {"role": "user", "content": question} ] response = openai.ChatCompletion.create( model="gpt-3.5-turbo-16k", messages=message_log, max_tokens=8800, request_timeout=35, stop=None, temperature=0.9 ) return response.choices[0].message.content # Create the Gradio interface iface = gr.Interface( fn=chatbot, inputs=gr.components.Textbox(lines=7, placeholder="Enter your question here"), outputs="text", title="Frost AI ChatBot: Your Knowledge Companion Powered-by ChatGPT", description="Ask any question about rahasak research papers" ) # Launch the Gradio interface iface.launch(share=True)