Spaces:
Runtime error
Runtime error
Updated app
Browse filesFiles changed (2)
- app.py+9-11
- requirements.txt+3-1
10 unmodified lines1112131415161718192021222324252627285 unmodified lines34353637383910 unmodified linestorch_dtype="auto",).to("cuda" if torch.cuda.is_available() else "cpu") # Check for GPU availability# Define the Gradio interfaceiface = gr.Interface(fn=generate_code,inputs=[gr.Textbox(lines=2, placeholder="Enter your Python code prompt")],outputs="textbox",title="Python Code Completion",description="Generate code completions using a large language model.",)# Define the main function for code generationdef generate_code(prompt):inputs = tokenizer(prompt, return_tensors="pt").to(model.device)tokens = model.generate(5 unmodified linesgenerated_code = tokenizer.decode(tokens[0], skip_special_tokens=True)return generated_code# Launch the Gradio appiface.launch()10 unmodified lines111213141516175 unmodified lines23242526272829303132333435363710 unmodified linestorch_dtype="auto",).to("cuda" if torch.cuda.is_available() else "cpu") # Check for GPU availability# Define the main function for code generationdef generate_code(prompt):inputs = tokenizer(prompt, return_tensors="pt").to(model.device)tokens = model.generate(5 unmodified linesgenerated_code = tokenizer.decode(tokens[0], skip_special_tokens=True)return generated_code# Define the Gradio interfaceiface = gr.Interface(fn=generate_code,inputs=[gr.Textbox(lines=2, placeholder="Enter your Python code prompt")],outputs="textbox",title="Python Code Completion",description="Generate code completions using a large language model.",)# Launch the Gradio appiface.launch()
123torchgradiotransformers12345gradiotorchtransformerseinopsaccelerate
app.py+9-11
requirements.txt+3-1