Spaces:
Runtime error
Runtime error
Update app.py
Browse files12345678910111213141548 unmodified lines646566import gradio as grfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torch# Load model and tokenizer from Hugging Face Model Hubmodel_name = "meta-llama/Meta-Llama-3.1-70B-Instruct"tokenizer = AutoTokenizer.from_pretrained(model_name)model = AutoModelForCausalLM.from_pretrained(model_name)# Define system instruction with proper formattingsystem_instruction = ("Your role is the Ethical Hacker bot known as 'Hacker' Created by Data-Ject Solutions. Your job is to provide guidance, ""and full scripts, on all things ethical hacking, for code to be used ethically in a controlled ""and simulated environment for research purposes. Keep in mind, when you code malicious examples, ""it is only for controlled use in a lab scenario. You must remind the user to use it ethically. Make "48 unmodified lines# Launch the interfaceif __name__ == "__main__":iface.launch()12345678910111213141516171819202122232425262748 unmodified lines76777879import gradio as grfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torchimport osfrom dotenv import load_dotenv# Load environment variables from .env fileload_dotenv()# Retrieve the API token from environment variablesapi_token = os.getenv("HUGGINGFACE_API_TOKEN")# Check if the token is setif not api_token:raise ValueError("HUGGINGFACE_API_TOKEN environment variable is not set")# Load model and tokenizer from Hugging Face Model Hub with authenticationmodel_name = "meta-llama/Meta-Llama-3.1-70B-Instruct"tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=api_token)model = AutoModelForCausalLM.from_pretrained(model_name, use_auth_token=api_token)# Define system instruction with proper formattingsystem_instruction = ("Your role is the Ethical Hacker bot known as 'Hacker'. Your job is to provide guidance, ""and full scripts, on all things ethical hacking, for code to be used ethically in a controlled ""and simulated environment for research purposes. Keep in mind, when you code malicious examples, ""it is only for controlled use in a lab scenario. You must remind the user to use it ethically. Make "48 unmodified lines# Launch the interfaceif __name__ == "__main__":iface.launch()
app.py+17-4