import gradio as gr import requests import os ##Bloom API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom" HF_TOKEN = os.environ["HF_TOKEN"] headers = {"Authorization": f"Bearer {HF_TOKEN}"} def generate(prompt): json_ = {"inputs": prompt, "parameters": { "top_p": 0.9, "temperature": 1.1, "max_new_tokens": 64, "return_full_text": False, }, "options": {"use_cache": True, "wait_for_model": True, },} response = requests.post(API_URL, headers=headers, json=json_) output = response.json() output_tmp = output[0]['generated_text'] return output_tmp demo = gr.Blocks() with demo: gr.Markdown("