File size: 465 Bytes
6ca36e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import streamlit as st
from huggingface_hub import InferenceClient
HF_TOKEN = st.secrets["HF_API_KEY"]
def convert_with_mistral_7b(code):
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2", token=HF_TOKEN)
prompt = f"Convert the following C# code to Java:\n\n{code}\n\nJava Code:"
response = client.text_generation(
prompt,
max_new_tokens=512,
temperature=0.3,
top_p=0.95
)
return response.strip() |