import streamlit as st import json import asyncio import os import EdgeGPT from EdgeGPT import Chatbot, ConversationStyle import re async def get_model_reply(prompt, style, cookies, context=[]): context = [prompt] cookies = json.loads(cookies) # Rest of the code... # UI code using Streamlit def main(): st.title("New Bing Chat GPT4") st.markdown(""" - If the response is "1", it means the service is busy. We recommend trying again later. - If the response is "0", please refresh the page and try again. - If the response is "-1", the account needs to be reactivated using a proxy server. - If the response is "-2", the account requires human verification on the Bing chat page. **Note:** The code has been updated to return the desired format when [choices = None] is passed, which means no specific choices mode is selected. """) inputs = st.text_input("Enter your question", "Hello") style = st.selectbox("Response Style", ["creative", "balanced", "precise"]) # Load cookies from JSON file with open('./cookies.json', 'r') as f: cookies = json.load(f) if st.button("Send Request"): state = [] responses, state = asyncio.run(get_model_reply(inputs, style, json.dumps(cookies), state)) if len(responses) > 0: for user, bot in responses: st.text("User: " + user) st.text("Bot: " + bot) st.markdown("---") if __name__ == "__main__": main()