Spaces:
Sleeping
Sleeping
Update app.py
Browse files1 unmodified line23456767891011891011121314151617181319202116222324252627281 unmodified linefrom code_editor import code_editorimport randomimport timeimport requestsimport os
words = ["Create", "Write", "Generate", "Make", "Simplify", "Extend"]l = Trueword = Nonewhile l: word = random.choice(words) time.sleep(5)API_URL = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"headers = {"Authorization": f"Bearer {os.environ.get("API_KEY")}
def query(payload): response = requests.post(API_URL, headers=headers, json=payload) return response.json() output = query({ "inputs": "Can you please let us know more details about your ",})
st.markdown(f":blue_background[{word}] Code With AI")st.markdown(f":blue_background[Create] Code With AI")st.write("Real-time Code Generation & Code Editor")lang = st.select_box("Choose Language", ["Python", "Javascript", "HTML", "C++", "C#", "Markdown", "Java", "C", "Go", "Ruby"])code = code_editor("# Your Code Here", height=[1, 200], lang=lang)code = code_editor("# Your Code Here", height=[1, 200], lang=lang)if st.button("Run AI"): output = query({ "inputs": f"Can you please correct and improve this code, as output give only updated code; code to correct and improve: {code}", }) if output: code = code_editor(output, height=[1, 200], lang=lang)app.py+20-8