File size: 717 Bytes
23e4842
 
34addff
23e4842
 
 
83687a7
23e4842
 
 
5de60ed
a6aff1f
23e4842
 
 
 
 
 
 
 
 
388e3c1
23e4842
cddd181
 
23e4842
d5895ee
23e4842
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()