Spaces:
Runtime error
Runtime error
File size: 827 Bytes
00cd123 dc3ff8d 0aafcd5 00cd123 dc3ff8d 00cd123 dc3ff8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|