Skip to content

Commit

Permalink
feat: add every esrgan models (#8)
Browse files Browse the repository at this point in the history
* feat: add every esrgan models

* feat: update model shortnames

* feat: update disabled model list
  • Loading branch information
aykutkardas authored Mar 7, 2024
1 parent ecc7503 commit 2eef279
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function UpscalerBattleground() {
const result: Record<string, any> = await fal.subscribe(firstModel.model, {
input: {
image_url: resizedImage,
...(firstModel.meta || {}),
},
logs: true,
onQueueUpdate: (update) => {
Expand Down Expand Up @@ -89,6 +90,7 @@ export default function UpscalerBattleground() {
const result: Record<string, any> = await fal.subscribe(secondModel.model, {
input: {
image_url: resizedImage,
...(secondModel.meta || {}),
},
logs: true,
onQueueUpdate: (update) => {
Expand Down Expand Up @@ -204,15 +206,15 @@ export default function UpscalerBattleground() {
<div className="flex w-full items-end justify-between border-y py-2 mb-3">
<div className="w-1/2 flex justify-start">
<ModelDropdown
disableList={[secondModel?.model]}
disableList={[firstModel?.name, secondModel?.name]}
onSelect={(model) => setFirstModel(model)}
value={firstModel}
/>
</div>

<div className="w-1/2 flex justify-end">
<ModelDropdown
disableList={[firstModel?.model]}
disableList={[firstModel?.name, secondModel?.name]}
onSelect={(model) => setSecondModel(model)}
value={secondModel}
/>
Expand Down
53 changes: 51 additions & 2 deletions components/model-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface Model {
name: string;
model: string;
link: string;
meta?: Record<string, any>;
}

export const UPSCALE_MODELS: Model[] = [
Expand All @@ -27,9 +28,57 @@ export const UPSCALE_MODELS: Model[] = [
},
{
shortname: "ESRGAN",
name: "ESRGAN Upscaler",
name: "ESRGAN x4 Plus",
model: "fal-ai/esrgan",
link: "https://fal.ai/models/esrgan",
meta: {
model: "RealESRGAN_x4plus",
},
},
{
shortname: "ESRGAN",
name: "ESRGAN x2 Plus",
model: "fal-ai/esrgan",
link: "https://fal.ai/models/esrgan",
meta: {
model: "RealESRGAN_x2plus",
},
},
{
shortname: "ESRGAN",
name: "ESRGAN x4 Plus Anime 6B",
model: "fal-ai/esrgan",
link: "https://fal.ai/models/esrgan",
meta: {
model: "RealESRGAN_x4plus_anime_6B",
},
},
{
shortname: "ESRGAN",
name: "ESRGAN x4 v3",
model: "fal-ai/esrgan",
link: "https://fal.ai/models/esrgan",
meta: {
model: "RealESRGAN_x4_v3",
},
},
{
shortname: "ESRGAN",
name: "ESRGAN x4 Wdn v3",
model: "fal-ai/esrgan",
link: "https://fal.ai/models/esrgan",
meta: {
model: "RealESRGAN_x4_wdn_v3",
},
},
{
shortname: "ESRGAN",
name: "ESRGAN x4 Anime v3",
model: "fal-ai/esrgan",
link: "https://fal.ai/models/esrgan",
meta: {
model: "RealESRGAN_x4_anime_v3",
},
},
{
shortname: "SUPIR",
Expand Down Expand Up @@ -66,7 +115,7 @@ export function ModelDropdown({
{UPSCALE_MODELS.map((model) => (
<DropdownMenuItem
key={model.name}
disabled={disableList.includes(model.model)}
disabled={disableList.includes(model.name)}
onClick={() => onSelect(model)}
>
{model.name}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export function cn(...inputs: ClassValue[]) {
}

export function formatTime(ms: number) {
if (ms < 1000) return `${ms}ms`;
if (ms < 1000) return `${Math.floor(ms)}ms`;
return `${(ms / 1000).toFixed(1)}s`;
}

0 comments on commit 2eef279

Please sign in to comment.