Spaces:
Runtime error
Runtime error
Download app.py from johnhelf/codeinterpreter-api: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/spaces/johnhelf/codeinterpreter-api/resolve/27c02bdec617358b94dbdfa00a33391341650e9a/app.py
- Command line
-
hf download hf://spaces/johnhelf/codeinterpreter-api@27c02bdec617358b94dbdfa00a33391341650e9a/app.py
-
curl -L -o app.py https://huggingface.co/spaces/johnhelf/codeinterpreter-api/resolve/27c02bdec617358b94dbdfa00a33391341650e9a/app.py
605 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(prompt, files): | |
| async with CodeInterpreterSession(model="gpt-3.5-turbo") as session: | |
| response = await session.generate_response(prompt, files=files) | |
| return [response.content,response.files] | |
| app = gr.Interface( | |
| fn=codeinterpreter, inputs=[ | |
| gr.TextBox(label="prompt",info="input the prompt"), | |
| gr.Files(), | |
| ], outputs=["text","gallery"] | |
| ) | |
| app.launch() |