|
import gradio as gr |
|
import openai |
|
def generate_completion(user_prompt): |
|
hidden_context = " " |
|
prompt = hidden_context + user_prompt |
|
response = openai.Completion.create( |
|
model="davinci:ft-topwow-llc:vendorpoweren-2023-09-18-22-16-36", |
|
prompt=prompt, |
|
max_tokens=30, |
|
temperature=0, |
|
stop=["_END"] |
|
) |
|
|
|
|
|
return response.choices[0].text.strip() |
|
iface = gr.Interface(fn=generate_completion, |
|
inputs=gr.inputs.Textbox(lines=5, placeholder='Escriba la frase aqui'), |
|
outputs='text', |
|
title="Potential customer purchase intention detector", |
|
description="Potential customer purchase intention detector. Write the phrase and add the arrow -> plus three spaces, example: I remain unconvinced of the quality -> ", |
|
input_labels="frase", |
|
output_labels="prediccion") |
|
|
|
iface.launch() |