vinayakj02's picture
increase context length
0aafcd5
raw
history blame contribute delete
No virus
827 Bytes
import gradio as gr
import openai
import os
openai.api_key = os.getenv("OPENAI_API_KEY")
def generate_latex(code):
response = openai.Completion.create(
model="text-davinci-003",
prompt= f"{code}\nGenerate Pseudocode from given code snippet using the latex packages algorithm and algpseudocode\nLatex Code : "
,temperature=0.5,
top_p=0.9,
max_tokens=300,
)
return "\\usepackage{algorithm}\n\\usepackage{algpseudocode}" + response['choices'][0]["text"]
iface = gr.Interface(
fn = generate_latex,
inputs = "text",
outputs = "text",
title = "Generate LATEX code for psuedocode from any language",
description = "Enter your code snippet in any language and get the psuedocode in LATEX format, made by vinayakj02",
)
iface.launch()