import streamlit as st import os import requests import io from PIL import Image st.title("Cinematic Text-to-Image Generation") st.write("Enter text and generate cinematic photo. Optional tag is POV") prompt = st.text_input("Enter prompt") hf_token = os.environ.get("api_token") headers = {"Authorization": f"Bearer {hf_token}"} API_URL = "https://api-inference.huggingface.co/models/TheLastBen/Filmic" def query(payload): response = requests.post(API_URL, headers=headers, json=payload) return response.content def generate_image(input_text): image_bytes = query({ "inputs": input_text, }) image = Image.open(io.BytesIO(image_bytes)) return image if prompt: output = generate_image(prompt) st.image(output, caption="Generated image")