Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -188,13 +188,20 @@ def train_model(epochs):
|
|
188 |
loss.backward()
|
189 |
optimizer.step()
|
190 |
|
191 |
-
if i %
|
192 |
status = f"Epoch [{epoch}/{epochs}], Step [{i}/{len(dataloader)}], Loss: {loss.item():.8f}"
|
193 |
print(status)
|
194 |
output_text.append(status)
|
195 |
|
196 |
return model, "\n".join(output_text)
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
# Gradio interface function
|
199 |
def gradio_train(epochs):
|
200 |
model, training_log = train_model(int(epochs))
|
|
|
188 |
loss.backward()
|
189 |
optimizer.step()
|
190 |
|
191 |
+
if i % 10 == 0:
|
192 |
status = f"Epoch [{epoch}/{epochs}], Step [{i}/{len(dataloader)}], Loss: {loss.item():.8f}"
|
193 |
print(status)
|
194 |
output_text.append(status)
|
195 |
|
196 |
return model, "\n".join(output_text)
|
197 |
|
198 |
+
# Push model to Hugging Face Hub
|
199 |
+
def push_model_to_hub(model, repo_id):
|
200 |
+
wrapper = UNetWrapper(model, repo_id)
|
201 |
+
wrapper.push_to_hub()
|
202 |
+
# Push the model to the Hugging Face hub
|
203 |
+
#model.push_to_hub(repo_name)
|
204 |
+
|
205 |
# Gradio interface function
|
206 |
def gradio_train(epochs):
|
207 |
model, training_log = train_model(int(epochs))
|