File size: 2,111 Bytes
f42fa3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"use server"

import { Client } from "@gradio/client"

export async function upscalePanorama({
  image,
  prompt
}: {
  image: string
  prompt: string
}): Promise<string> {
  const app = await Client.connect("jbilcke-hf/clarity-upscaler-api")

 // const dataUri = await fetch(`data:image/jpeg;base64,${base64Data}`)
  const dataUri = await fetch(image)

  const imageBlob = await dataUri.blob()

  const result = await app.predict("/predict", {
    "Secret Token": process.env.MICRO_SERVICE_SECRET_TOKEN || "",

    // convert the base64 image to blob
    "Image": imageBlob,

    Prompt: `360° HDRI panorama photo, ${prompt}`,

    "Negative Prompt": "blurry, cropped",

    "Scalue Factor": 2,
  
    "Dynamic": 6,

    "Creativity": 0.35,

    "Resemblance": 0.6,

    "tiling_width": 112,

    "tiling_height": 144,

   // epicrealism_naturalSinRC1VAE.safetensors [84d76a0328]', 'juggernaut_reborn.safetensors [338b85bc4f]', 'flat2DAnimerge_v45Sharp.safetensors'],
    "sd_model": "juggernaut_reborn.safetensors [338b85bc4f]",
    "scheduler": "DPM++ 3M SDE Karras",
  })
  /*

  inputs.append(gr.Slider(
      label="Num Inference Steps", info='''Number of denoising steps''', value=18,
      minimum=1, maximum=100, step=1,
  ))
  
  inputs.append(gr.Number(
      label="Seed", info='''Random seed. Leave blank to randomize the seed''', value=1337
  ))
  
  inputs.append(gr.Checkbox(
      label="Downscaling", info='''Downscale the image before upscaling. Can improve quality and speed for images with high resolution but lower quality''', value=False
  ))
  
  inputs.append(gr.Number(
      label="Downscaling Resolution", info='''Downscaling resolution''', value=768
  ))
  
  inputs.append(gr.Textbox(
      label="Lora Links", info='''Link to a lora file you want to use in your upscaling. Multiple links possible, seperated by comma'''
  ))
  
  inputs.append(gr.Textbox(
      label="Custom Sd Model", info='''Link to a custom safetensors checkpoint file you want to use in your upscaling. Will overwrite sd_model checkpoint.'''
  ))
  
  ])
  */
  console.log(`result:`, result)

  return ""
}