import json import requests import gradio as gr API_TOKEN='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' headers = {"Authorization": f"Bearer {API_TOKEN}"} API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom" prompt=""" Input:cake shop Output:In 2050, cake shops may have a larger focus on sustainability, using eco-friendly packaging and locally sourced ingredients. They may also incorporate more technology, such as online ordering and virtual reality cake tastings. Customization options for customers, such as allergen-free and vegan cakes, may also be more prevalent. Delivery drones may be used to quickly and efficiently deliver cakes to customers. ##### Input:consulting firm Output: In 2050, consulting firms will have a significant presence in virtual and augmented reality, allowing for remote and immersive consulting experiences. Artificial intelligence and machine learning will play a larger role in data analysis and decision-making for consulting projects. Sustainability and environmental consciousness will be major considerations for consulting firms, as they help clients navigate the transition to a green economy. The use of blockchain technology will increase in consulting, allowing for secure and transparent tracking of data and financial transactions. ##### Input:biscuit brand Output: In 2050, biscuit brands may have to compete with a variety of alternative, plant-based options as more consumers become conscious of their health and the environment. With advancements in technology, biscuits may be produced with even longer shelf lives and better taste, making them a convenient option for busy consumers on the go. Biscuit packaging may become more eco-friendly, using materials that can be easily recycled or biodegraded to reduce waste. Online shopping and delivery services may become even more popular, making it easier for consumers to purchase biscuits from anywhere, at any time. ##### Input:hair salon Output: """ def query(text): global prompt text = prompt+"\nInput:"+text + "\nOutput:" print(text) payload = { "inputs": text, "parameters": { "max_length": 250, "temperature": 0.9 }, } data = json.dumps(payload) print(data) print(headers) response = requests.request("POST", API_URL, headers=headers, data=data) print('Response here\n',response.content) return json.loads(response.content.decode("utf-8"))[0]['generated_text'] with gr.Blocks() as demo: textbox = gr.Textbox(placeholder="Type business type here and press enter...", lines=4) btn = gr.Button("Generate") output1 = gr.Textbox(lines=4,label='1') btn.click(complete_with_gpt,inputs=[textbox], outputs=[output1]) demo.launch()