import gradio as gr # Create a pipeline gpt2 = pipeline('text-generation', model=model, tokenizer=tokenizer) def predict(prompt): generated_text = gpt2(prompt, max_length=100)[0]['generated_text'] return generated_text title = "GPT-Guide: London" description = """ This model is trained to provide recommendations for exploring London. Ask it about places to visit, eat, and experience in London! """ article = "Want more tips? Check out [Visit London](https://www.visitlondon.com/) for comprehensive guides and ideas." gr.Interface( fn=predict, inputs="textbox", outputs="text", title=title, description=description, article=article, examples=[["Can you recommend an activity in London?"],["What are the best museums in London?"], ["Where can I find the best food in London?"],["What is the significance of pubs in London?"]], ).launch(share=True)