Spaces:
Sleeping
Sleeping
File size: 1,605 Bytes
5618c63 30d1f93 5618c63 30d1f93 5618c63 30d1f93 5618c63 30d1f93 5618c63 30d1f93 5618c63 30d1f93 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import os
import gradio as gr
import torch
from diffusers import StableDiffusionPipeline
# মডেল আইডি এবং পাইপলাইন সেটআপ (১৬ জিবি র্যাম ও CPU-এর জন্য অপ্টিমাইজড)
model_id = "OFA-Sys/small-stable-diffusion-v0"
# torch_dtype এর জায়গায় সঠিক নিয়ম (dtype) ব্যবহার করা হলো অবসোলেট এরর এড়াতে
pipe = StableDiffusionPipeline.from_pretrained(model_id, dtype=torch.float32)
pipe = pipe.to("cpu")
def generate_video_frame(prompt):
# প্রম্পট দিয়ে ইমেজ ফ্রেম তৈরি
image = pipe(prompt, num_inference_steps=15).images[0]
return image
# গ্রাডিও ইউজার ইন্টারফেস (মোবাইল ফ্রেন্ডলি)
interface = gr.Interface(
fn=generate_video_frame,
inputs=gr.Textbox(label="আপনার এআই প্রম্পট লিখুন", placeholder="A running cat, cinematic..."),
outputs=gr.Image(label="Generated Output"),
title="Rayhan's Free AI Space",
description="এই স্পেসটি সম্পূর্ণ ফ্রিতে এবং আনলিমিটেড বার ব্যবহার করতে পারবেন।"
)
if __name__ == "__main__":
# ভুল 'docker_setting' আর্গুমেন্টটি ফেলে দিয়ে ক্লিন কোড করা হলো
interface.launch(server_name="0.0.0.0", server_port=7860)
|