CoolFace
Apppublic

AGayathriiii/DotNetJavaCodeConversion

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
mistral7b.py15 linesDownload Raw Back to backend
1import streamlit as st2from huggingface_hub import InferenceClient3 4HF_TOKEN = st.secrets["HF_API_KEY"]5 6def convert_with_mistral_7b(code):7    client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2", token=HF_TOKEN)8    prompt = f"Convert the following C# code to Java:\n\n{code}\n\nJava Code:"9    response = client.text_generation(10        prompt, 11        max_new_tokens=512, 12        temperature=0.3, 13        top_p=0.9514    )15    return response.strip()