Chen An commited on
Commit ·
bcee648
1
Parent(s): 4e25d6b
update
Browse files13 unmodified lines1415161718192038 unmodified lines596061626364654 unmodified lines70717273747513 unmodified linesraise ValueError("HUGGINGFACE_TOKEN environment variable not set.")tokenizer = LlamaTokenizerFast.from_pretrained("meta-llama/Llama-3.2-1B",use_fast=False,token=hf_token # Updated parameter)38 unmodified lines# Decode the generated tokensoutput_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)# Extract the output after 'Output:'output_parts = output_text.split('Output:')if len(output_parts) > 1:4 unmodified lines# Parse JSON if possibletry:category_dict = json.loads(category_output)return json.dumps(category_dict, indent=2)except json.JSONDecodeError:return category_output13 unmodified lines1415161718192038 unmodified lines596061626364654 unmodified lines7071727374757613 unmodified linesraise ValueError("HUGGINGFACE_TOKEN environment variable not set.")tokenizer = LlamaTokenizerFast.from_pretrained("meta-llama/Llama-3.2-3B",use_fast=False,token=hf_token # Updated parameter)38 unmodified lines# Decode the generated tokensoutput_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)print(output_text)# Extract the output after 'Output:'output_parts = output_text.split('Output:')if len(output_parts) > 1:4 unmodified lines# Parse JSON if possibletry:category_dict = json.loads(category_output)return json.dumps(category_dict, indent=2)except json.JSONDecodeError:return category_output
app.py+3-2