Skip to content

Commit e9d8920

Browse files
authored
Merge pull request #197 from microsoft/bruno-add-hfmcp-blazor
Add Hugging Face - Generate Image Blazor Sample App
2 parents e3df7d3 + 2afad89 commit e9d8920

File tree

84 files changed

+63701
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+63701
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\HFMCP.GenImage.ServiceDefaults\HFMCP.GenImage.ServiceDefaults.csproj" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
// Add service defaults & Aspire client integrations.
4+
builder.AddServiceDefaults();
5+
6+
// Add services to the container.
7+
builder.Services.AddProblemDetails();
8+
9+
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
10+
builder.Services.AddOpenApi();
11+
12+
var app = builder.Build();
13+
14+
// Configure the HTTP request pipeline.
15+
app.UseExceptionHandler();
16+
17+
if (app.Environment.IsDevelopment())
18+
{
19+
app.MapOpenApi();
20+
}
21+
22+
string[] summaries = ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"];
23+
24+
app.MapGet("/weatherforecast", () =>
25+
{
26+
var forecast = Enumerable.Range(1, 5).Select(index =>
27+
new WeatherForecast
28+
(
29+
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
30+
Random.Shared.Next(-20, 55),
31+
summaries[Random.Shared.Next(summaries.Length)]
32+
))
33+
.ToArray();
34+
return forecast;
35+
})
36+
.WithName("GetWeatherForecast");
37+
38+
app.MapDefaultEndpoints();
39+
40+
app.Run();
41+
42+
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
43+
{
44+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
45+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"http": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": false,
8+
"applicationUrl": "http://localhost:5451",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development"
11+
}
12+
},
13+
"https": {
14+
"commandName": "Project",
15+
"dotnetRunMessages": true,
16+
"launchBrowser": false,
17+
"applicationUrl": "https://localhost:7525;http://localhost:5451",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
}
22+
}
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var builder = DistributedApplication.CreateBuilder(args);
2+
3+
var apiService = builder.AddProject<Projects.HFMCP_GenImage_ApiService>("apiservice")
4+
.WithHttpHealthCheck("/health");
5+
6+
builder.AddProject<Projects.HFMCP_GenImage_Web>("webfrontend")
7+
.WithExternalHttpEndpoints()
8+
.WithHttpHealthCheck("/health")
9+
.WithReference(apiService)
10+
.WaitFor(apiService);
11+
12+
builder.Build().Run();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Sdk Name="Aspire.AppHost.Sdk" Version="9.3.1" />
4+
5+
<PropertyGroup>
6+
<OutputType>Exe</OutputType>
7+
<TargetFramework>net9.0</TargetFramework>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
<Nullable>enable</Nullable>
10+
<UserSecretsId>b21583bc-8f6c-44c1-9458-dc461d139d79</UserSecretsId>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\HFMCP.GenImage.ApiService\HFMCP.GenImage.ApiService.csproj" />
15+
<ProjectReference Include="..\HFMCP.GenImage.Web\HFMCP.GenImage.Web.csproj" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.3.1" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"https": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": true,
8+
"applicationUrl": "https://localhost:17147;http://localhost:15040",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development",
11+
"DOTNET_ENVIRONMENT": "Development",
12+
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21063",
13+
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22007"
14+
}
15+
},
16+
"http": {
17+
"commandName": "Project",
18+
"dotnetRunMessages": true,
19+
"launchBrowser": true,
20+
"applicationUrl": "http://localhost:15040",
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development",
23+
"DOTNET_ENVIRONMENT": "Development",
24+
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19077",
25+
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20182"
26+
}
27+
}
28+
}
29+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning",
6+
"Aspire.Hosting.Dcp": "Warning"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)