Spaces:
Running
Running
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from huggingface_hub import InferenceClient
|
| 4 |
-
|
| 5 |
-
client = InferenceClient(token=os.environ.get("HF_TOKEN"))
|
| 6 |
-
|
| 7 |
-
def make_image(prompt):
|
| 8 |
-
if not prompt.strip():
|
| 9 |
-
raise gr.Error("اكتب وصف الصورة أولاً")
|
| 10 |
-
try:
|
| 11 |
-
return client.text_to_image(
|
| 12 |
-
prompt, model="black-forest-labs/FLUX.1-schnell"
|
| 13 |
-
)
|
| 14 |
-
except Exception as e:
|
| 15 |
-
raise gr.Error(f"تعذر التوليد (قد تكون الحصة انتهت): {e}")
|
| 16 |
-
|
| 17 |
-
with gr.Blocks(title="Rebel") as demo:
|
| 18 |
-
gr.Markdown("# 🐢 Rebel — استوديو الذكاء الاصطناعي")
|
| 19 |
-
with gr.Tab("🖼️ صور"):
|
| 20 |
-
p = gr.Textbox(label="الوصف", lines=2)
|
| 21 |
-
b = gr.Button("توليد", variant="primary")
|
| 22 |
-
o = gr.Image(label="النتيجة")
|
| 23 |
-
b.click(make_image, p, o)
|
| 24 |
-
|
| 25 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|