agent / app.py
Antoine245's picture
Update app.py
cddd181
import torch
import gradio as gr
import os
from transformers import AlignProcessor, AlignModel
from transformers import AzureOpenAiAgent, OpenAiAgent
agent = OpenAiAgent(model="text-davinci-003", api_key=os.environ.get("openai_key"))
def predict(text):
return agent.run("Is the following `text` (in French) positif ou négatif?", text=text)
description = """
"""
gr.Interface(
fn=predict,
inputs=[
gr.inputs.Textbox(lines=1, placeholder="Enter text",)
],
outputs=gr.Textbox(),
examples=[
["J'adore la tartiflette"],
["Je déteste les choux à la crème"]
],
title="Votre phrase est-elle négative ou positive?",
description=description
).launch()