Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from spiralfilm import FilmCore, FilmConfig | |
| def greet(name): | |
| return "こんにちは " + name + "さん!! \n僕はパスカルくんだよ。よろしくね" | |
| async def summarize(text: str, url: str): | |
| _prompt = f""" | |
| 以下の文章を要約してください。 | |
| {text} | |
| """ | |
| config = FilmConfig( | |
| "gpt-3.5-turbo", | |
| api_type="azure", | |
| azure_deployment_id="gpt-35-turbo", | |
| azure_api_version="2023-05-15", | |
| timeout=60.0, # これを入れないとtimeoutが頻繁に発生する | |
| ) | |
| config.get_apikey() | |
| film = FilmCore( | |
| prompt=_prompt, | |
| system_prompt="あなたは優秀なライターです。", | |
| config=config | |
| ) | |
| return await film.run_async() | |
| async def chat(text, url): | |
| return await summarize(text, url) | |
| iface = gr.Interface(fn=chat, inputs=["text", "url"], outputs="text") | |
| if __name__ == "__main__": | |
| iface.launch(auth=("spiralai", "spiralai"), share=True) | |