Spaces:
Running
Running
Yash Worlikar
commited on
Commit
•
2a517cc
1
Parent(s):
465e14b
docker fix for app and hf
Browse files- Components/Pages/Home.razor +8 -2
- Dockerfile +3 -1
- wwwroot/app.css +1 -1
Components/Pages/Home.razor
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
<h4 class="card-title fw-bold required text-start">Image</h4>
|
23 |
<div class="form-group mb-3">
|
24 |
<!-- HTML -->
|
25 |
-
<label for="upload-image" class="custom-upload-button btn btn-primary">
|
26 |
Upload Image
|
27 |
</label>
|
28 |
<InputFile OnChange="HandleSelectedFiles" accept=".jpg,.png" class="btn btn-primary" id="upload-image" aria-describedby="fileHelp"></InputFile>
|
@@ -103,15 +103,18 @@
|
|
103 |
[Inject]
|
104 |
private NavigationManager Navigation { get; set; } = default!;
|
105 |
|
106 |
-
|
107 |
private bool isProcessingResponse = false;
|
|
|
108 |
private string errorMessage = string.Empty;
|
109 |
private CancellationTokenSource _cts = new CancellationTokenSource();
|
110 |
|
111 |
|
112 |
private async Task HandleSelectedFiles(InputFileChangeEventArgs e)
|
113 |
{
|
|
|
114 |
var imageFile = e.File;
|
|
|
115 |
if (imageFile != null)
|
116 |
{
|
117 |
// Ensure the TempImages folder exists
|
@@ -129,6 +132,9 @@
|
|
129 |
var relativePath = Path.Combine("temp", imageFile.Name);
|
130 |
ImageUrl = Navigation.ToAbsoluteUri(relativePath).ToString();
|
131 |
}
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
private async Task<ReadOnlyMemory<byte>> ReadFileBytes(IBrowserFile imageFile)
|
|
|
22 |
<h4 class="card-title fw-bold required text-start">Image</h4>
|
23 |
<div class="form-group mb-3">
|
24 |
<!-- HTML -->
|
25 |
+
<label for="upload-image" class="custom-upload-button btn btn-primary @isUploadingImage">
|
26 |
Upload Image
|
27 |
</label>
|
28 |
<InputFile OnChange="HandleSelectedFiles" accept=".jpg,.png" class="btn btn-primary" id="upload-image" aria-describedby="fileHelp"></InputFile>
|
|
|
103 |
[Inject]
|
104 |
private NavigationManager Navigation { get; set; } = default!;
|
105 |
|
106 |
+
private bool isProcessingIngredients = false;
|
107 |
private bool isProcessingResponse = false;
|
108 |
+
private string isUploadingImage = string.Empty;
|
109 |
private string errorMessage = string.Empty;
|
110 |
private CancellationTokenSource _cts = new CancellationTokenSource();
|
111 |
|
112 |
|
113 |
private async Task HandleSelectedFiles(InputFileChangeEventArgs e)
|
114 |
{
|
115 |
+
isUploadingImage = "disabled";
|
116 |
var imageFile = e.File;
|
117 |
+
await InvokeAsync(() => this.StateHasChanged());
|
118 |
if (imageFile != null)
|
119 |
{
|
120 |
// Ensure the TempImages folder exists
|
|
|
132 |
var relativePath = Path.Combine("temp", imageFile.Name);
|
133 |
ImageUrl = Navigation.ToAbsoluteUri(relativePath).ToString();
|
134 |
}
|
135 |
+
isUploadingImage = string.Empty;
|
136 |
+
await InvokeAsync(() => this.StateHasChanged());
|
137 |
+
|
138 |
}
|
139 |
|
140 |
private async Task<ReadOnlyMemory<byte>> ReadFileBytes(IBrowserFile imageFile)
|
Dockerfile
CHANGED
@@ -25,6 +25,8 @@ USER root
|
|
25 |
RUN useradd -m -u 1000 user
|
26 |
COPY --from=publish /app/publish .
|
27 |
RUN mkdir -p /app/wwwroot/temp
|
28 |
-
RUN
|
|
|
|
|
29 |
USER app
|
30 |
ENTRYPOINT ["dotnet", "FoodHealthChecker.dll"]
|
|
|
25 |
RUN useradd -m -u 1000 user
|
26 |
COPY --from=publish /app/publish .
|
27 |
RUN mkdir -p /app/wwwroot/temp
|
28 |
+
RUN groupadd mygroup && usermod -a -G mygroup user && usermod -a -G mygroup app
|
29 |
+
RUN chown :mygroup -R /app/wwwroot/temp
|
30 |
+
RUN chmod 770 -R /app/wwwroot/temp
|
31 |
USER app
|
32 |
ENTRYPOINT ["dotnet", "FoodHealthChecker.dll"]
|
wwwroot/app.css
CHANGED
@@ -136,7 +136,7 @@ h1, h2, h3, h4, h5, h6 {
|
|
136 |
border-color: #00796B;
|
137 |
}
|
138 |
|
139 |
-
.btn-primary:hover, .btn-primary:active, .btn-primary:focus, .btn-primary:disabled {
|
140 |
background-color: #00796B;
|
141 |
border-color: #004D40;
|
142 |
}
|
|
|
136 |
border-color: #00796B;
|
137 |
}
|
138 |
|
139 |
+
.btn-primary:hover, .btn-primary:active, .btn-primary:focus, .btn-primary:disabled, .btn-primary.disabled {
|
140 |
background-color: #00796B;
|
141 |
border-color: #004D40;
|
142 |
}
|