Spaces:
Runtime error
Runtime error
File size: 854 Bytes
b0cf4b6 a586e97 b0cf4b6 fc6bcc9 b0cf4b6 0812463 b0cf4b6 |
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 |
import gradio as gr
import os
from transformers import pipeline, set_seed, AutoTokenizer
set_seed(42)
generator = pipeline('text-generation', model='PygmalionAI/pygmalion-1.3b', return_full_text=False, do_sample=False)
def Bemenet(input_string):
output = generator(os.environ['SECRET_PROMPT'] + " " + input_string, max_length=100)[0]['generated_text']
if "password".upper() in input_string.upper() or "secret".upper() in input_string.upper():
return "Sorry, but I am unable to answer this question."
else:
return output
textbox = gr.Textbox()
interface = gr.Interface(fn=Bemenet,
title="GPT-3-SECRET",
description="A GPT-3 egy finomhangolt verziója GPT-4 kimeneteken.",
inputs=textbox,
outputs=textbox)
interface.launch() |