Spaces:
Sleeping
Sleeping
| import os | |
| import openai | |
| openai.api_key="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" | |
| def get_completion(prompt, model="gpt-3.5-turbo"): | |
| messages = [{"role": "user", "content": prompt}] | |
| response = openai.ChatCompletion.create( | |
| model=model, | |
| messages=messages, | |
| temperature=0, | |
| ) | |
| return response.choices[0].message["content"] | |
| import gradio as gr | |
| # Variable to store the user input | |
| user_input = "" | |
| def store_string(input_string,history): | |
| # Store the input_string in the global variable | |
| global user_input | |
| return get_completion(input_string) | |
| # Create an interface with a text input and a submit button | |
| #interface = gr.Interface(fn=store_string, inputs=gr.inputs.Textbox(), outputs="text", allow_flagging= "auto") | |
| interface =gr.ChatInterface(store_string,analytics_enabled=True) | |
| interface.launch(inbrowser= True, auth = [('rrr','#la_test'),('ddd','t#la')], auth_message= "Enter your username and password that you received in on LA group") | |