agent / app.py
Antoine245's picture
Update app.py
388e3c1
raw
history blame
682 Bytes
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):
agent.run("Is the following `text` (in French) positive or negative?", text=text)
description = """
"""
gr.Interface(
fn=predict,
inputs=[
gr.inputs.Textbox(lines=1, placeholder="Enter text",)
],
theme="grass",
outputs=gr.Textbox(),
examples=[
["My name is Antoine",],
],
title="Images vs labels créé avec ALIGN et Huggingface",
description=description
).launch()