CoolFace
Apppublic

AGayathriiii/DotNetJavaCodeConversion

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
mistrallarge2.py16 linesDownload Raw Back to backend
1import streamlit as st
2from huggingface_hub import InferenceClient
3
4HF_TOKEN = st.secrets["HF_API_KEY"]
5
6def convert_with_mistral_large2(code):
7    client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1", 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.95
14    )
15    return response.strip()
16