Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import torch
|
@@ -28,7 +27,7 @@ else:
|
|
28 |
saved_models = {}
|
29 |
|
30 |
# وظيفة لتدريب النموذج على الصور المرفوعة
|
31 |
-
def train_model(user_email, images
|
32 |
if not user_email:
|
33 |
return "يجب تسجيل الدخول لحفظ النموذج."
|
34 |
|
@@ -108,14 +107,14 @@ with gr.Blocks() as demo:
|
|
108 |
user_email_input = gr.Textbox(label="📧 بريدك الإلكتروني (اختياري لحفظ النموذج)")
|
109 |
train_button = gr.Button("🔧 تدريب النموذج")
|
110 |
train_output = gr.Textbox(label="🔔 نتيجة التدريب")
|
111 |
-
progress_bar = gr.Progress() # بدون label هنا
|
112 |
|
113 |
with gr.Column():
|
114 |
prompt_input = gr.Textbox(label="✏️ أدخل البرومبت لإنشاء صورة")
|
115 |
generate_button = gr.Button("🎨 إنشاء صورة")
|
116 |
output_image = gr.Image(label="📷 الصورة الناتجة")
|
117 |
|
118 |
-
|
|
|
119 |
generate_button.click(generate_image, inputs=[prompt_input, user_email_input], outputs=output_image)
|
120 |
|
121 |
gr.Markdown("### 🔑 تسجيل الدخول / التسجيل")
|
@@ -137,4 +136,4 @@ with gr.Blocks() as demo:
|
|
137 |
register_button.click(register, inputs=[register_email, register_password], outputs=register_output)
|
138 |
|
139 |
# تشغيل التطبيق مع رابط عام
|
140 |
-
demo.launch(share=True)
|
|
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import torch
|
|
|
27 |
saved_models = {}
|
28 |
|
29 |
# وظيفة لتدريب النموذج على الصور المرفوعة
|
30 |
+
def train_model(user_email, images):
|
31 |
if not user_email:
|
32 |
return "يجب تسجيل الدخول لحفظ النموذج."
|
33 |
|
|
|
107 |
user_email_input = gr.Textbox(label="📧 بريدك الإلكتروني (اختياري لحفظ النموذج)")
|
108 |
train_button = gr.Button("🔧 تدريب النموذج")
|
109 |
train_output = gr.Textbox(label="🔔 نتيجة التدريب")
|
|
|
110 |
|
111 |
with gr.Column():
|
112 |
prompt_input = gr.Textbox(label="✏️ أدخل البرومبت لإنشاء صورة")
|
113 |
generate_button = gr.Button("🎨 إنشاء صورة")
|
114 |
output_image = gr.Image(label="📷 الصورة الناتجة")
|
115 |
|
116 |
+
# تم إزالة progress_bar من هنا
|
117 |
+
train_button.click(train_model, inputs=[user_email_input, image_input], outputs=train_output)
|
118 |
generate_button.click(generate_image, inputs=[prompt_input, user_email_input], outputs=output_image)
|
119 |
|
120 |
gr.Markdown("### 🔑 تسجيل الدخول / التسجيل")
|
|
|
136 |
register_button.click(register, inputs=[register_email, register_password], outputs=register_output)
|
137 |
|
138 |
# تشغيل التطبيق مع رابط عام
|
139 |
+
demo.launch(share=True)
|