File size: 996 Bytes
f9e0a72
0bf4c6c
 
f9e0a72
 
7e7d53b
f9e0a72
 
 
 
 
0bf4c6c
e974db0
 
f9e0a72
ba18d69
0bf4c6c
dc85e2e
 
e974db0
 
 
 
 
 
dc85e2e
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
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import gradio as gr

tokenizer = AutoTokenizer.from_pretrained("merve/chatgpt-prompts-bart-long")
model = AutoModelForSeq2SeqLM.from_pretrained("merve/chatgpt-prompts-bart-long", from_tf=True)

def generate(prompt):
    batch = tokenizer(prompt, return_tensors="pt")
    generated_ids = model.generate(batch["input_ids"], max_new_tokens=150)
    output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
    return output[0]

input_component = gr.Textbox(label="Input a persona, e.g. photographer", value="photographer")
output_component = gr.Textbox(label="Prompt")
examples = [["photographer"], ["developer"]]
    description = ""

gr.Interface(
    generate, 
    inputs=input_component, 
    outputs=output_component, 
    examples=examples, 
    title="👨🏻‍🎤 ChatGPT Prompt Generator 👨🏻‍🎤", 
    description=description,
    theme="ParityError/Interstellar"  # Hinzugefügtes Theme
).launch()