import gradio as gr from transformers import pipeline generator = pipeline("text2text-generation", model="merve/chatgpt-prompts-bart-long") def generate_prompt(prompt): output = generator(prompt, max_length=250) return output[0]['generated_text'] def greet_user(name): return "Hello, " + name + "!" interface = gr.Interface( fn=generate_prompt, inputs=gr.inputs.Textbox(label="Prompt"), outputs=gr.outputs.Textbox(label="Generated Text"), title="Hugging by Einfach.Prompt Generator", description="Gebe Deinen Wunsch Prompt ein und schaue was er daraus macht", layout="vertical", examples=[ ["Was sind die Auswirkungen des Klimawandels?"], ["Beschreibe den Prozess der Photosynthese."], ["Erzähle mir einen Witz."] ], theme="default", server_port=7860 ) # Header header_html = "

Hugging by Einfach.Prompt Generator

" interface.layout = gr.Interface.Layout( header=header_html, inputs=[interface.inputs[0]], outputs=[interface.outputs[0]] ) # Add text and image interface.layout.add_component(gr.Interface.Text("Hugging by Einfach.Prompt Generator", label="Example Text")) interface.layout.add_component(gr.Interface.Image("path/to/image.jpg", label="Example Image")) interface.launch()