fugam commited on
Commit
dbf309c
·
verified ·
1 Parent(s): af24d5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -19
app.py CHANGED
@@ -1,25 +1,17 @@
1
  import gradio as gr
2
- from diffusers import StableDiffusionPipeline
3
- import torch
4
 
5
- # Charger le modèle Stable Diffusion
6
- pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
7
- pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu") # Utiliser GPU si disponible
 
 
8
 
9
- # Fonction pour générer une image
10
- def generate_image(prompt):
11
- image = pipe(prompt).images[0]
12
- return image
13
-
14
- # Interface Gradio
15
  interface = gr.Interface(
16
- fn=generate_image,
17
- inputs=gr.Textbox(lines=2, placeholder="Enter your prompt here...", label="Image Prompt"),
18
- outputs=gr.Image(type="pil", label="Generated Image"),
19
- title="Image Generator with Stable Diffusion",
20
- description="Enter a description, and the AI will generate an image based on it!"
21
  )
22
 
23
- # Lancer l'application
24
- if __name__ == "__main__":
25
- interface.launch()
 
1
  import gradio as gr
 
 
2
 
3
+ # دالة تنفذ تحويل النص أو الصورة إلى فيديو
4
+ def convert_to_video(input_text_or_image):
5
+ # هنا دير المنطق ديالك باستعمال الموديل
6
+ result = f"Processing: {input_text_or_image}"
7
+ return result
8
 
9
+ # اختيار الأدوات المناسبة (نص أو صورة)
 
 
 
 
 
10
  interface = gr.Interface(
11
+ fn=convert_to_video,
12
+ inputs=["text", "image"], # إدخال نص أو صورة
13
+ outputs="text" # نتيجة نصية
 
 
14
  )
15
 
16
+ # تشغيل الواجهة
17
+ interface.launch()