johnhelf's picture
Update app.py
11f72a1
raw
history blame
768 Bytes
# -* coding:UTF-8 -*
# !/usr/bin/env python
import numpy as np
import gradio as gr
import os
from PIL import Image
from codeinterpreterapi import CodeInterpreterSession
async def codeinterpreter(openai_key,prompt, files):
async with CodeInterpreterSession(model="gpt-3.5",openai_api_key=openai_key) as session:
#async with CodeInterpreterSession(model="gpt-3.5-turbo",openai_api_key="") as session:
response = await session.generate_response(prompt, files=files)
return [response.content,response.files]
app = gr.Interface(
fn=codeinterpreter, inputs=[
gr.Textbox(label="openai_key"),
gr.Textbox(label="prompt",info="input the prompt"),
gr.Files(),
], outputs=["text","gallery"]
)
app.launch()